Remove ambiguity for operator<

MSVC will try to build json object from value_t and use another operator<
This commit is contained in:
Alexander Nevskiy 2015-07-15 23:57:25 +03:00
parent 5ddff15c2a
commit c07e5577f2
2 changed files with 4 additions and 2 deletions

4
src/json.hpp Normal file → Executable file
View 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
View 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]);
}
}
}