|
Boost : |
Subject: Re: [boost] [patch] first_iterator, second_iterator?
From: Gabriel Redner (gredner_at_[hidden])
Date: 2010-01-07 21:50:09
On Thu, Jan 7, 2010 at 4:56 PM, Daniel Colascione
<daniel_at_[hidden]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 1/7/10 6:25 AM, Mathias Gaunard wrote:
>> Daniel Colascione wrote:
>>> Iterating over the first and second elements of a collection of pairs is
>>> a pretty common problem. Would it be possible to get something like the
>>> following into boost?
>>
>> Isn't that a trivial application of transform_iterator?
>>
>
> Sure, it can be implemented via transform_iterator too. And it is a
> trivial application. But it serves two purposes:
>
> 1) provides commonly-needed functionality with only a little additional code
>
> 2) provides examples for library users
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (Darwin)
>
> iEYEARECAAYFAktGWKoACgkQ17c2LVA10VsawgCgj1TBlPOLeIoaxub541hdxVWY
> FFMAoJovYYwOPtseJlDbCxGUOVr+jlfK
> =3w8v
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
FWIW, I've implemented exactly this tool in the codebase at work,
using the transform_iterator technique. I've also written an
analogous tool which extracts a particular element from each element
in a collection of boost::tuples. I'd have been happy to see either
or both as part of boost, or at least as examples in the iterator
library.
-Gabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk