|
Boost Users : |
Subject: Re: [Boost-users] [iterator] Problems with iterator_facade and const-qualification
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2011-05-06 12:59:06
Evan Driscoll wrote:
> I'm trying to use the iterator_facade and am running into trouble. It's
> not really caused by the iterator_facade, but I figured I'd ask anyway.
> This takes some explanation, so if anyone reads this, know that I *do*
> appreciate it. :-)
>
> TLDR version: I'm getting a compiler error about converting between
> pointers of iterator_facade<> instantiations with different const
> qualifications on the value_type. The code's attached, in addition to
> mostly appearing (with a few minor formatting changes) inline below.
> Please help me figure out what to do to fix it.
>
>
>
> What I'm doing is a bit roundabout, but here goes.
>
> One fault with C++ iterators (at least from some point of view) is that
> if you want to operate on different kinds of iterators you have to care
> about too much -- you need to know more than just the type that op*
> returns (which is all you care about most of the time, iterator_traits
> notwithstanding), but what the underlying iterator type is. This means
> that if you want to write code that operates on multiple kinds of
> iterators, it must be a template.
You might google any_iterator, and see how other authors have addressed
similar problems.
Jeff
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