mardi 20 octobre 2020

Is there a C++11 replacement for boost::reverse_iterator?

I've have an application that has been running on C++03 that makes use of boost::reverse_iterator. I've finally been able to upgrade to a C++11 compiler, and I've noticed that boost/iterator/reverse_iterator.hpp is no longer installed (I'm using Boost 1.74.0).

I assume that it's because C++11's std::reverse_iterator takes the place of it. Is that the case?

I tried using std::reverse_iterator in place of boost::reverse_iterator, but it does not work for me. The reason is that my base iterator, although it is random-access, is not a true STL "random access iterator" because its reference type is a proxy, not a true reference. When I use std::reverse_iterator, it tries to take the address of my "reference".

Is there a C++11 replacement for boost::reverse_iterator, or do I need to write one from scratch for my application?

Aucun commentaire:

Enregistrer un commentaire