mirror of
https://github.com/nlohmann/json.git
synced 2026-02-10 12:02:28 +00:00
💥 changed iterators to andom_access_iterator #593
This commit changes the iterator category to andom_access_iterator and allows offsets and subscript operators for object iterators.
This commit is contained in:
@@ -240,9 +240,8 @@ TEST_CASE("algorithms")
|
||||
SECTION("sorting an object")
|
||||
{
|
||||
json j({{"one", 1}, {"two", 2}});
|
||||
CHECK_THROWS_AS(std::sort(j.begin(), j.end()), json::invalid_iterator&);
|
||||
CHECK_THROWS_WITH(std::sort(j.begin(), j.end()),
|
||||
"[json.exception.invalid_iterator.209] cannot use offsets with object iterators");
|
||||
std::sort(j.begin(), j.end());
|
||||
CHECK(j == json({{"one", 1}, {"two", 2}}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user