|
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
Hi,
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.
Cheers,
Simon
-- Szymon Gatner The Lordz Games Studio www.thelordzgamesstudio.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