Commit 6f0053a2 authored by Niels's avatar Niels

Merge branch 'support-move-iterators' of https://github.com/robertmrk/json into develop

parents 507322e6 2197f5f0
...@@ -7000,13 +7000,13 @@ class basic_json ...@@ -7000,13 +7000,13 @@ class basic_json
} }
/// return a reference to the value pointed to by the iterator /// return a reference to the value pointed to by the iterator
reference operator*() reference operator*() const
{ {
return const_cast<reference>(base_iterator::operator*()); return const_cast<reference>(base_iterator::operator*());
} }
/// dereference the iterator /// dereference the iterator
pointer operator->() pointer operator->() const
{ {
return const_cast<pointer>(base_iterator::operator->()); return const_cast<pointer>(base_iterator::operator->());
} }
......
...@@ -7000,13 +7000,13 @@ class basic_json ...@@ -7000,13 +7000,13 @@ class basic_json
} }
/// return a reference to the value pointed to by the iterator /// return a reference to the value pointed to by the iterator
reference operator*() reference operator*() const
{ {
return const_cast<reference>(base_iterator::operator*()); return const_cast<reference>(base_iterator::operator*());
} }
/// dereference the iterator /// dereference the iterator
pointer operator->() pointer operator->() const
{ {
return const_cast<pointer>(base_iterator::operator->()); return const_cast<pointer>(base_iterator::operator->());
} }
......
...@@ -12407,5 +12407,16 @@ TEST_CASE("regression tests") ...@@ -12407,5 +12407,16 @@ TEST_CASE("regression tests")
CHECK(j3b.dump() == "1E04"); CHECK(j3b.dump() == "1E04");
CHECK(j3c.dump() == "1e04"); CHECK(j3c.dump() == "1e04");
} }
SECTION("issue #233 - Can't use basic_json::iterator as a base iterator for std::move_iterator")
{
json source = {"a", "b", "c"};
json expected = {"a", "b"};
json dest;
std::copy_n(std::make_move_iterator(source.begin()), 2, std::back_inserter(dest));
CHECK(dest == expected);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment