In https://github.com/nlohmann/json/issues/1387, a user was facing difficulty because he was using map class.
Map class sorts it's elements on the basis of < function.
Now this meant that the bug existed in inline bool operator<
If you are to look at the Numerics Mentioned beside the comment in the previous code base, you would find that they do not match the one mentioned/implied in enum class value_t
The correction of these values fixes the issue altogether
This commit is contained in:
Pratik Chowdhury 2018-12-09 16:34:38 +05:30 committed by GitHub
parent e73dfef6e5
commit 21dcd4bd39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,8 +63,8 @@ Returns an ordering that is similar to Python:
inline bool operator<(const value_t lhs, const value_t rhs) noexcept
{
static constexpr std::array<std::uint8_t, 8> order = {{
0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,
1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */
0 /* null */, 1 /* object */, 2 /* array */, 3 /* string */,
4 /* boolean */, 5 /* integer */, 6 /* unsigned */, 7 /* float */
}
};