From a97509977f74cfb44dfcd28166a692c3df622e70 Mon Sep 17 00:00:00 2001 From: Alexander Nevskiy Date: Sat, 13 Jun 2015 00:49:33 +0300 Subject: [PATCH] Remove ambiguity for operator< MSVC will try to build json object from value_t and use another operator< --- src/json.hpp | 5 +++-- test/unit.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 64ca73b81..44626657c 100755 --- a/src/json.hpp +++ b/src/json.hpp @@ -1994,8 +1994,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; + // we compare types. Have to use operator< explicitly in order to + // not cause ambiguity on MS compiler + return operator<(lhs_type, rhs_type); } /// comparison: less than or equal diff --git a/test/unit.cpp b/test/unit.cpp index cedcb9ba8..ddff76039 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -6202,7 +6202,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] ); } } }