MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / operator<

Function operator<

native/thirdpart/json/json.hpp:2877–2888  ·  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 - furthermore, each type is not smaller than itself - discarded values are not comparable @since version 1.0.0 */

Source from the content-addressed store, hash-verified

2875@since version 1.0.0
2876*/
2877inline bool operator<(const value_t lhs, const value_t rhs) noexcept
2878{
2879 static constexpr std::array<std::uint8_t, 8> order = {{
2880 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,
2881 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */
2882 }
2883 };
2884
2885 const auto l_index = static_cast<std::size_t>(lhs);
2886 const auto r_index = static_cast<std::size_t>(rhs);
2887 return l_index < order.size() and r_index < order.size() and order[l_index] < order[r_index];
2888}
2889} // namespace detail
2890} // namespace nlohmann
2891

Callers 1

operator()Method · 0.70

Calls 2

basic_jsonFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected