I have a pair of iterators (say a std::map<A,B>::iterator but could just as easily be a vector of std::pair<A,B> or such).
I want some iterator type that wraps these original iterators but deferences to a different type (e.g. B& rather than std::pair<A,B>&) that can then be used by other templates (or things using auto/decltpye) as if it was a std::list<B>::iterator or similar (the conversion is completely hidden, they can be advanced, compared, deferenced, have that reference modified, etc.).
I have seen something similar on boost, but it appeared to deal with wrapping the container rather than the iterators, e.g. for (auto v : mymap | boost::adaptors::values), but in this case I just have iterators not a container.
Aucun commentaire:
Enregistrer un commentaire