1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-31 10:24:23 +03:00

Allow comparing default initialized iterators (#4512)

This commit is contained in:
Niels Lohmann
2024-11-26 06:35:14 +01:00
committed by GitHub
parent ee32bfc1c2
commit 3d6c664de2
5 changed files with 89 additions and 41 deletions

View File

@ -0,0 +1,35 @@
// __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.3
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#include "doctest_compatibility.h"
#include <string>
#include <unordered_map>
#include <vector>
#include <nlohmann/json.hpp>
using nlohmann::json;
#if (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#define JSON_HAS_CPP_14
#endif
#ifdef JSON_HAS_CPP_14
TEST_CASE_TEMPLATE("checking forward-iterators", T, // NOLINT(readability-math-missing-parentheses)
std::vector<int>, std::string, nlohmann::json)
{
auto it1 = typename T::iterator{};
auto it2 = typename T::iterator{};
CHECK(it1 == it2);
CHECK(it1 <= it2);
CHECK(it1 >= it2);
CHECK_FALSE(it1 != it2);
CHECK_FALSE(it1 < it2);
CHECK_FALSE(it1 > it2);
}
#endif