:art: use Clang-Format
diff --git a/.clang-format b/.clang-format index 571a6ec..64ee00f 100644 --- a/.clang-format +++ b/.clang-format
@@ -78,6 +78,6 @@ SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: c++11 +Standard: Latest TabWidth: 4 UseTab: Never
diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index e3237d6..f782d48 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp
@@ -857,9 +857,9 @@ /// @brief 3-way compares two JSON pointers template<typename RefStringTypeRhs> - std::strong_ordering operator<= > (const json_pointer<RefStringTypeRhs>& rhs) const noexcept // *NOPAD* + std::strong_ordering operator<=>(const json_pointer<RefStringTypeRhs>& rhs) const noexcept // *NOPAD* { - return reference_tokens <= > rhs.reference_tokens; // *NOPAD* + return reference_tokens <=> rhs.reference_tokens; // *NOPAD* } #else /// @brief compares two JSON pointers for equality
diff --git a/include/nlohmann/detail/value_t.hpp b/include/nlohmann/detail/value_t.hpp index 337d4d4..446ee5d 100644 --- a/include/nlohmann/detail/value_t.hpp +++ b/include/nlohmann/detail/value_t.hpp
@@ -77,7 +77,7 @@ @since version 1.0.0 */ #if JSON_HAS_THREE_WAY_COMPARISON -inline std::partial_ordering operator<= > (const value_t lhs, const value_t rhs) noexcept // *NOPAD* +inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* #else inline bool operator<(const value_t lhs, const value_t rhs) noexcept #endif @@ -99,7 +99,7 @@ #if JSON_HAS_THREE_WAY_COMPARISON if (l_index < order.size() && r_index < order.size()) { - return order[l_index] <= > order[r_index]; // *NOPAD* + return order[l_index] <=> order[r_index]; // *NOPAD* } return std::partial_ordering::unordered; #else @@ -114,7 +114,7 @@ #if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) inline bool operator<(const value_t lhs, const value_t rhs) noexcept { - return std::is_lt(lhs <= > rhs); // *NOPAD* + return std::is_lt(lhs <=> rhs); // *NOPAD* } #endif
diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index d0b55b1..6552553 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp
@@ -3671,7 +3671,8 @@ /// @brief comparison: equal /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/ template<typename ScalarType> - requires std::is_scalar_v<ScalarType> bool operator==(ScalarType rhs) const noexcept + requires std::is_scalar_v<ScalarType> + bool operator==(ScalarType rhs) const noexcept { return *this == basic_json(rhs); } @@ -3689,24 +3690,24 @@ /// @brief comparison: 3-way /// @sa https://json.nlohmann.me/api/basic_json/operator_spaceship/ - std::partial_ordering operator<= > (const_reference rhs) const noexcept // *NOPAD* + std::partial_ordering operator<=>(const_reference rhs) const noexcept // *NOPAD* { const_reference lhs = *this; // default_result is used if we cannot compare values. In that case, // we compare types. - JSON_IMPLEMENT_OPERATOR(<= >, // *NOPAD* + JSON_IMPLEMENT_OPERATOR(<=>, // *NOPAD* std::partial_ordering::equivalent, std::partial_ordering::unordered, - lhs_type <= > rhs_type) // *NOPAD* + lhs_type <=> rhs_type) // *NOPAD* } /// @brief comparison: 3-way /// @sa https://json.nlohmann.me/api/basic_json/operator_spaceship/ template<typename ScalarType> requires std::is_scalar_v<ScalarType> - std::partial_ordering operator<= > (ScalarType rhs) const noexcept // *NOPAD* + std::partial_ordering operator<=>(ScalarType rhs) const noexcept // *NOPAD* { - return *this <= > basic_json(rhs); // *NOPAD* + return *this <=> basic_json(rhs); // *NOPAD* } #if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON @@ -3728,7 +3729,8 @@ /// @brief comparison: less than or equal /// @sa https://json.nlohmann.me/api/basic_json/operator_le/ template<typename ScalarType> - requires std::is_scalar_v<ScalarType> bool operator<=(ScalarType rhs) const noexcept + requires std::is_scalar_v<ScalarType> + bool operator<=(ScalarType rhs) const noexcept { return *this <= basic_json(rhs); } @@ -3748,7 +3750,8 @@ /// @brief comparison: greater than or equal /// @sa https://json.nlohmann.me/api/basic_json/operator_ge/ template<typename ScalarType> - requires std::is_scalar_v<ScalarType> bool operator>=(ScalarType rhs) const noexcept + requires std::is_scalar_v<ScalarType> + bool operator>=(ScalarType rhs) const noexcept { return *this >= basic_json(rhs); } @@ -5117,7 +5120,7 @@ ::nlohmann::detail::value_t rhs) const noexcept { #if JSON_HAS_THREE_WAY_COMPARISON - return std::is_lt(lhs <= > rhs); // *NOPAD* + return std::is_lt(lhs <=> rhs); // *NOPAD* #else return ::nlohmann::detail::operator<(lhs, rhs); #endif
diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 1ac7c07..ed8a232 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp
@@ -4263,7 +4263,7 @@ #if JSON_HAS_THREE_WAY_COMPARISON if (l_index < order.size() && r_index < order.size()) { - return order[l_index] <= > order[r_index]; // *NOPAD* + return order[l_index] <=> order[r_index]; // *NOPAD* } return std::partial_ordering::unordered; #else @@ -4278,7 +4278,7 @@ #if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) inline bool operator<(const value_t lhs, const value_t rhs) noexcept { - return std::is_lt(lhs <= > rhs); // *NOPAD* + return std::is_lt(lhs <=> rhs); // *NOPAD* } #endif @@ -14444,9 +14444,9 @@ /// @brief 3-way compares two JSON pointers template<typename RefStringTypeRhs> - std::strong_ordering operator<= > (const json_pointer<RefStringTypeRhs>& rhs) const noexcept // *NOPAD* + std::strong_ordering operator<=> (const json_pointer<RefStringTypeRhs>& rhs) const noexcept // *NOPAD* { - return reference_tokens <= > rhs.reference_tokens; // *NOPAD* + return reference_tokens <=> rhs.reference_tokens; // *NOPAD* } #else /// @brief compares two JSON pointers for equality @@ -23182,24 +23182,24 @@ /// @brief comparison: 3-way /// @sa https://json.nlohmann.me/api/basic_json/operator_spaceship/ - std::partial_ordering operator<= > (const_reference rhs) const noexcept // *NOPAD* + std::partial_ordering operator<=> (const_reference rhs) const noexcept // *NOPAD* { const_reference lhs = *this; // default_result is used if we cannot compare values. In that case, // we compare types. - JSON_IMPLEMENT_OPERATOR(<= >, // *NOPAD* + JSON_IMPLEMENT_OPERATOR(<=>, // *NOPAD* std::partial_ordering::equivalent, std::partial_ordering::unordered, - lhs_type <= > rhs_type) // *NOPAD* + lhs_type <=> rhs_type) // *NOPAD* } /// @brief comparison: 3-way /// @sa https://json.nlohmann.me/api/basic_json/operator_spaceship/ template<typename ScalarType> requires std::is_scalar_v<ScalarType> - std::partial_ordering operator<= > (ScalarType rhs) const noexcept // *NOPAD* + std::partial_ordering operator<=> (ScalarType rhs) const noexcept // *NOPAD* { - return *this <= > basic_json(rhs); // *NOPAD* + return *this <=> basic_json(rhs); // *NOPAD* } #if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON @@ -24610,7 +24610,7 @@ ::nlohmann::detail::value_t rhs) const noexcept { #if JSON_HAS_THREE_WAY_COMPARISON - return std::is_lt(lhs <= > rhs); // *NOPAD* + return std::is_lt(lhs <=> rhs); // *NOPAD* #else return ::nlohmann::detail::operator<(lhs, rhs); #endif
diff --git a/single_include/nlohmann/json_fwd.hpp b/single_include/nlohmann/json_fwd.hpp index 71a88a5..a053939 100644 --- a/single_include/nlohmann/json_fwd.hpp +++ b/single_include/nlohmann/json_fwd.hpp
@@ -24,6 +24,8 @@ // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> // SPDX-License-Identifier: MIT + + // This file contains all macro definitions affecting or depending on the ABI #ifndef JSON_SKIP_LIBRARY_VERSION_CHECK @@ -113,6 +115,7 @@ } // namespace nlohmann #endif + /*! @brief namespace for Niels Lohmann @see https://github.com/nlohmann
diff --git a/tests/src/unit-comparison.cpp b/tests/src/unit-comparison.cpp index 73a1361..1b0042d 100644 --- a/tests/src/unit-comparison.cpp +++ b/tests/src/unit-comparison.cpp
@@ -175,7 +175,7 @@ { CAPTURE(i) CAPTURE(j) - CHECK((j_types[i] <= > j_types[j]) == expected[i][j]); // *NOPAD* + CHECK((j_types[i] <=> j_types[j]) == expected[i][j]); // *NOPAD* } } } @@ -561,7 +561,7 @@ { CAPTURE(i) CAPTURE(j) - CHECK((j_values[i] <= > j_values[j]) == expected[i][j]); // *NOPAD* + CHECK((j_values[i] <=> j_values[j]) == expected[i][j]); // *NOPAD* } } }
diff --git a/tests/src/unit-json_pointer.cpp b/tests/src/unit-json_pointer.cpp index b161adc..4201715 100644 --- a/tests/src/unit-json_pointer.cpp +++ b/tests/src/unit-json_pointer.cpp
@@ -703,7 +703,7 @@ // build with C++20 // JSON_HAS_CPP_20 #if JSON_HAS_THREE_WAY_COMPARISON - CHECK((ptr1 <= > ptr2) == std::strong_ordering::less); // *NOPAD* + CHECK((ptr1 <=> ptr2) == std::strong_ordering::less); // *NOPAD* CHECK(ptr2 > ptr1); #endif }