This commit is contained in:
kepkin 2015-07-15 22:02:00 +00:00
commit 3d77448171
2 changed files with 13 additions and 8 deletions

10
src/json.hpp Normal file → Executable file
View File

@ -2931,8 +2931,8 @@ class basic_json
*/
template <class InteratorType, typename
std::enable_if<
std::is_same<InteratorType, typename basic_json::iterator>::value or
std::is_same<InteratorType, typename basic_json::const_iterator>::value
std::is_same<InteratorType, typename __basic_json::iterator>::value or
std::is_same<InteratorType, typename __basic_json::const_iterator>::value
, int>::type
= 0>
InteratorType erase(InteratorType first, InteratorType last)
@ -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);
}
/*!
@ -4852,7 +4854,7 @@ class basic_json
};
/// an iterator value
union internal_iterator
struct internal_iterator
{
/// iterator for JSON objects
typename object_t::iterator object_iterator;

11
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]);
}
}
}
@ -8163,9 +8163,11 @@ TEST_CASE("parser class")
SECTION("escaped")
{
// quotation mark "\""
CHECK(json::parser("\"\\\"\"").parse() == R"("\"")"_json);
auto r1 = R"("\"")"_json;
CHECK(json::parser("\"\\\"\"").parse() == r1);
// reverse solidus "\\"
CHECK(json::parser("\"\\\\\"").parse() == R"("\\")"_json);
auto r2 = R"("\\")"_json;
CHECK(json::parser("\"\\\\\"").parse() == r2);
// solidus
CHECK(json::parser("\"\\/\"").parse() == R"("/")"_json);
// backspace
@ -9738,7 +9740,8 @@ TEST_CASE("regression tests")
{
auto s = "[\"\\\"foo\\\"\"]";
json j = json::parse(s);
CHECK(j == R"(["\"foo\""])"_json);
auto expected = R"(["\"foo\""])"_json;
CHECK(j == expected);
}
}