Boost logo

Boost Users :

From: Simon Buchan (simon_at_[hidden])
Date: 2005-09-22 19:34:52


Tzu-Chien Chiu wrote:
> In Pyhon:
>
> y = [foo(_1) for _1 in x]
>
> In C++:
>
> list<int> x;
> x.push_back(...);
> ..
>
> list<int> y;
> for (list<int>::iterator it = x.begin(); x.end() != it; ++ it)
> y.push_back( foo(y) );
>
> With boost, can we write the Python-like statement:
>
> copy( x.begin(), x.end(), magic_back_inserter(foo(_1), y) ); // pseudo-code
>
> --
> Tzu-Chien Chiu,
> 3D Graphics Hardware Architect
> <URL:http://www.csie.nctu.edu.tw/~jwchiu>
But what would an expression-template version look like?
y = for_( _1 >> in >> x)[foo]
That is what the composition operator would be for:
operator _, say, so we could do :
foo for_ _1 in x


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