Remove ambiguity for operator<
MSVC will try to build json object from value_t and use another operator<
This commit is contained in:
parent
5ddff15c2a
commit
c07e5577f2
4
src/json.hpp
Normal file → Executable file
4
src/json.hpp
Normal file → Executable file
@ -4286,7 +4286,9 @@ class basic_json
|
||||
|
||||
// We only reach this line if we cannot compare values. In that case,
|
||||
// we compare types.
|
||||
return lhs_type < rhs_type;
|
||||
// Have to use operator< explicitly in order to
|
||||
// not cause ambiguity on MS compiler
|
||||
return operator<(lhs_type, rhs_type);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
2
test/unit.cpp
Normal file → Executable file
2
test/unit.cpp
Normal file → Executable file
@ -6939,7 +6939,7 @@ TEST_CASE("lexicographical comparison operators")
|
||||
CAPTURE(i);
|
||||
CAPTURE(j);
|
||||
// check precomputed values
|
||||
CHECK( (j_types[i] < j_types[j]) == expected[i][j] );
|
||||
CHECK(operator<(j_types[i], j_types[j]) == expected[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user