TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ operator<()

bool nlohmann::detail::operator< ( const value_t  lhs,
const value_t  rhs 
)
inlinenoexcept

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 string would be surprising behavior in a JSON file.
Since
version 1.0.0

Definition at line 147 of file json.hpp.

148{
149 static constexpr std::array<std::uint8_t, 9> order = {{
150 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,
151 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */,
152 6 /* binary */
153 }
154 };
155 const auto l_index = static_cast<std::size_t>(lhs);
156 const auto r_index = static_cast<std::size_t>(rhs);
157 return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index];
158}