💥 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:
Niels Lohmann
2017-08-16 21:35:22 +02:00
parent aba8b58492
commit c77a0be5f3
3 changed files with 68 additions and 138 deletions

View File

@@ -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}}));
}
}