4 ms·
As less haskellish approach to functional programming boost library: http://www.boost.org/doc/libs/1_55_0/libs/range/doc/html/index.html http://www.boost.org/do
by kozikow 13y ago
As less haskellish approach to functional programming boost library: http://www.boost.org/doc/libs/1_55_0/libs/range/doc/html/index.html http://www.boost.org/doc/libs/1_55_0/libs/range/doc/html/ind... is nice.
It allows me to write:
v | filtered( [] (int i) { return i % 2 == 0;}) | transformed([] (int i) { return i * 2;})
instead of:
vector<int> filtered;
copy_if(begin(v), end(v), back_inserter(filtered), [](int x) { return x % 2 == 0;});
vector<int> transformed;
transform(begin(filtered), end(filtered), back_inserter(transformed), [](int x) { return x * 2;});