MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / operator<

Function operator<

dependencies/json/json.hpp:3471–3483  ·  view source on GitHub ↗

! @brief comparison operator for JSON types Returns an ordering that is similar to Python: - order: null < boolean < number < object < array < string < binary - furthermore, each type is not smaller than itself - discarded values are not comparable - binary is represented as a b"" string in python and directly comparable to a string; however, making a binary array directly comparable with a str

Source from the content-addressed store, hash-verified

3469@since version 1.0.0
3470*/
3471inline bool operator<(const value_t lhs, const value_t rhs) noexcept
3472{
3473 static constexpr std::array<std::uint8_t, 9> order = {{
3474 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,
3475 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */,
3476 6 /* binary */
3477 }
3478 };
3479
3480 const auto l_index = static_cast<std::size_t>(lhs);
3481 const auto r_index = static_cast<std::size_t>(rhs);
3482 return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index];
3483}
3484} // namespace detail
3485} // namespace nlohmann
3486

Callers 1

operator()Method · 0.70

Calls 3

createFunction · 0.70
basic_jsonFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected