Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] Range adaptors and compatibility with non-adapted iterators
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2012-01-11 05:11:52


2012/1/11 John M. Dlugosz <mpbecey7gu_at_[hidden]>:
> Consider something like this:
>    themap_type::iterator search_for (int val)
>    {
>        return boost::find_if (themap|map_values, my_predicate(val));
>    }
> The return from the function chokes because the adapted iterator type cannot
> be convered back to the original type of iterator in the parent collection.

Adapted iterators have base() method that returns underlying iterator. For every
level of adaptation just call base() on resulting iterator to get to
the base one.


Szymon Gatner
The Lordz Games Studio

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at