Boost logo

Boost Users :

Subject: Re: [Boost-users] transform_iterator and c++11 lambda expression
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-09-21 23:42:56


> hello
> it would be great to be pass
>
> transform_iterator( my_iterator, []( reference ) { return /// something } );
>
> directly to STL algorithms.
>
> Currently, one needs to define separately the unarfy function as far
> as i could see

You can use the 'regular' function from Akira Takahashi's extensions to the
Boost.Range library [1] like so:

make_transform_iterator(my_iterator, regular([]( ... ) { ... }));

If you are using the 'transformed' range adaptor instead of using
transform_iterator directly, it's even nicer: you just use '|+' to pipe
the adaptor instead of '|'. That is,

R | transformed([](...){...})

becomes

R |+ transformed([](...){...})

Regards,
Nate

[1] http://dl.dropbox.com/u/1682460/git/OvenToBoost/libs/range/doc/html/range_extension/reference/algorithm_extension/regular.html
                                               


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