🎨 fix format
This commit is contained in:
parent
3483d923d4
commit
b0a3883081
2 changed files with 23 additions and 22 deletions
|
@ -5650,17 +5650,17 @@ class basic_json
|
||||||
Or you can self-defined operator equal function like this:
|
Or you can self-defined operator equal function like this:
|
||||||
@code {.cpp}
|
@code {.cpp}
|
||||||
bool my_equal(const_reference lhs, const_reference rhs) {
|
bool my_equal(const_reference lhs, const_reference rhs) {
|
||||||
const auto lhs_type lhs.type();
|
const auto lhs_type lhs.type();
|
||||||
const auto rhs_type rhs.type();
|
const auto rhs_type rhs.type();
|
||||||
if (lhs_type == rhs_type) {
|
if (lhs_type == rhs_type) {
|
||||||
switch(lhs_type)
|
switch(lhs_type)
|
||||||
// self_defined case
|
// self_defined case
|
||||||
case value_t::number_float:
|
case value_t::number_float:
|
||||||
return std::abs(lhs - rhs) <= std::numeric_limits<float>::epsilon();
|
return std::abs(lhs - rhs) <= std::numeric_limits<float>::epsilon();
|
||||||
// other cases remain the same with the original
|
// other cases remain the same with the original
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
|
@ -20509,19 +20509,20 @@ class basic_json
|
||||||
Or you can self-defined operator equal function like this:
|
Or you can self-defined operator equal function like this:
|
||||||
@code {.cpp}
|
@code {.cpp}
|
||||||
bool my_equal(const_reference lhs, const_reference rhs) {
|
bool my_equal(const_reference lhs, const_reference rhs) {
|
||||||
const auto lhs_type lhs.type();
|
const auto lhs_type lhs.type();
|
||||||
const auto rhs_type rhs.type();
|
const auto rhs_type rhs.type();
|
||||||
if (lhs_type == rhs_type) {
|
if (lhs_type == rhs_type) {
|
||||||
switch(lhs_type)
|
switch(lhs_type)
|
||||||
// self_defined case
|
// self_defined case
|
||||||
case value_t::number_float:
|
case value_t::number_float:
|
||||||
return std::abs(lhs - rhs) <= std::numeric_limits<float>::epsilon();
|
return std::abs(lhs - rhs) <= std::numeric_limits<float>::epsilon();
|
||||||
// other cases remain the same with the original
|
// other cases remain the same with the original
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@note NaN values never compare equal to themselves or to other NaN values.
|
@note NaN values never compare equal to themselves or to other NaN values.
|
||||||
|
|
||||||
@param[in] lhs first JSON value to consider
|
@param[in] lhs first JSON value to consider
|
||||||
|
|
Loading…
Reference in a new issue