|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2008-08-21 21:14:09
on Tue Aug 19 2008, e r <erwann.rogard-AT-gmail.com> wrote:
> hello,
>
> i have a build error when i try to use an iterator derived from
> iterator_facade<Iter> with Iter an iterator over a const Range. It's the
> const that causes the error. See the *.hpp below and an example.
The problem is that the reference type of Iter is value_type& when it
should be value_type const&. The value_type of a constant iterator is
still non-const, and you're getting the Value parameter by asking the
value_type of BaseIter.
> any other suggestion to improve the *hpp also appreciated.
Use iterator_adaptor; all your problems will go away and your code will
get smaller.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
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