You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While it's possible to move a range of container elements instead of copying them by using the std::move algorithm instead of std::copy, some copying algorithms like std::copy_if and std::copy_n doesn't have a move counterpart. The only way to use move semantics with these algorithms is to wrap the input iterators into std::move_iterator objects.
Unfortunately, creating a move_iterator from a basic_json::iterator is not possible, because the indirection operator of move_iterator is a const member function and it can't call the non-const indirection operator of basic_json::iterator.
Compiling the code above with AppleClang 7.0.0 (which is based on clang 3.7 I think), will produce the following error:
The issue can be fixed by making the indirection operator of basic_json::iterator const, and while we're at it, we can safely make the dereference operator const too, since the non-const iterators in STL have a const indirection and dereference operator too.
The text was updated successfully, but these errors were encountered:
While it's possible to move a range of container elements instead of copying them by using the std::move algorithm instead of std::copy, some copying algorithms like std::copy_if and std::copy_n doesn't have a move counterpart. The only way to use move semantics with these algorithms is to wrap the input iterators into std::move_iterator objects.
Unfortunately, creating a move_iterator from a basic_json::iterator is not possible, because the indirection operator of move_iterator is a const member function and it can't call the non-const indirection operator of basic_json::iterator.
Compiling the code above with AppleClang 7.0.0 (which is based on clang 3.7 I think), will produce the following error:
The issue can be fixed by making the indirection operator of basic_json::iterator const, and while we're at it, we can safely make the dereference operator const too, since the non-const iterators in STL have a const indirection and dereference operator too.
The text was updated successfully, but these errors were encountered: