Merge pull request #2176 from gracicot/cpp20-support-no-std-fct-templ-specialization

C++20 support by removing swap specialization
This commit is contained in:
Niels Lohmann 2020-06-21 20:39:58 +02:00 committed by GitHub
commit 29ad2178c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 80 additions and 5 deletions

View file

@ -154,7 +154,7 @@ TEST_CASE("concepts")
json j {1, 2, 3};
json::iterator it1 = j.begin();
json::iterator it2 = j.end();
std::swap(it1, it2);
swap(it1, it2);
CHECK(it1 == j.end());
CHECK(it2 == j.begin());
}
@ -162,7 +162,7 @@ TEST_CASE("concepts")
json j {1, 2, 3};
json::const_iterator it1 = j.cbegin();
json::const_iterator it2 = j.cend();
std::swap(it1, it2);
swap(it1, it2);
CHECK(it1 == j.end());
CHECK(it2 == j.begin());
}

View file

@ -878,7 +878,8 @@ TEST_CASE("modifiers")
json j("hello world");
json k(42.23);
std::swap(j, k);
using std::swap;
swap(j, k);
CHECK(j == json(42.23));
CHECK(k == json("hello world"));