From b0a388308133d1dfd1962f11b4c7b47f3805832b Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 13 Apr 2020 13:11:26 +0200 Subject: [PATCH] :art: fix format --- include/nlohmann/json.hpp | 22 +++++++++++----------- single_include/nlohmann/json.hpp | 23 ++++++++++++----------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 336d69fe..594d807e 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -5650,17 +5650,17 @@ class basic_json Or you can self-defined operator equal function like this: @code {.cpp} bool my_equal(const_reference lhs, const_reference rhs) { - const auto lhs_type lhs.type(); - const auto rhs_type rhs.type(); - if (lhs_type == rhs_type) { - switch(lhs_type) - // self_defined case - case value_t::number_float: - return std::abs(lhs - rhs) <= std::numeric_limits::epsilon(); - // other cases remain the same with the original - ... - } - ... + const auto lhs_type lhs.type(); + const auto rhs_type rhs.type(); + if (lhs_type == rhs_type) { + switch(lhs_type) + // self_defined case + case value_t::number_float: + return std::abs(lhs - rhs) <= std::numeric_limits::epsilon(); + // other cases remain the same with the original + ... + } + ... } @endcode diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 20f0d211..3295892a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20509,19 +20509,20 @@ class basic_json Or you can self-defined operator equal function like this: @code {.cpp} bool my_equal(const_reference lhs, const_reference rhs) { - const auto lhs_type lhs.type(); - const auto rhs_type rhs.type(); - if (lhs_type == rhs_type) { - switch(lhs_type) - // self_defined case - case value_t::number_float: - return std::abs(lhs - rhs) <= std::numeric_limits::epsilon(); - // other cases remain the same with the original - ... - } - ... + const auto lhs_type lhs.type(); + const auto rhs_type rhs.type(); + if (lhs_type == rhs_type) { + switch(lhs_type) + // self_defined case + case value_t::number_float: + return std::abs(lhs - rhs) <= std::numeric_limits::epsilon(); + // other cases remain the same with the original + ... + } + ... } @endcode + @note NaN values never compare equal to themselves or to other NaN values. @param[in] lhs first JSON value to consider