Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2004-05-12 21:39:50


"Neal Becker" <ndbecker2_at_[hidden]> wrote in message
news:c7uljb$etk$1_at_sea.gmane.org...
> In iterator_facade.hpp:
>
> reference operator*() const
>
> Why the const?

So you could dereference const iterators

> I am writing function_input_iterator (again), using
> iterator_facade. The functor used as a generator may not be const - it
> might well have state. Therefore, dereference changes the state, and so
> isn't const.

Make'em mutable. Dereference is 'naturally' const operation. So special
cases should be marked as special.

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk