Boost logo

Boost Users :

Subject: [Boost-users] iterator_adaptor : const and regular form
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2011-08-15 14:38:17


I wrote an iterator by deriving from the boost::iterator_adaptor template.

Now I need the const_iterator for my collection, too.
The instructions for iterator_adaptor are not clear, but the implication is that I should
transfer what I read from iterator_facade. So, is using a const type for the Value (the
3rd template argument) all it takes to write a proper const_iterator? (assuming the
functions I supply are proper, too)

So, I can just write my iterator as a template of T, passing T through as Value to the
iterator_adaptor base class, and then instantiate _that_ with my value type and with const
value type to make iterator and const_iterator respectively, right?

—John


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net