3 ms·
There is a C++ library proposal to implement (lazy) range algorithms and overload the operator| for their composition: http://www.open-std.org/jtc1/sc22/wg21/d
by ot 16y ago
There is a C++ library proposal to implement (lazy) range algorithms and overload the operator| for their composition:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1871.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n187...
it would allow to do things like
std::copy( ptr_vec | std::reversed | std::indirected,
std::ostream_iterator<int>( std::cout ) );
Boost.Range implements part of the proposal, a much more complete implementation is Oven (http://p-stade.sourceforge.net/oven/doc/html/index.html http://p-stade.sourceforge.net/oven/doc/html/index.html), which includes the pipe operator, but I think it is unmaintained.
The result can be very readable and robust, I've seen complex production code using extensively this syntax.
- pstademb 16y agoNow Oven is fortunately maintained by awesome hackers in Japan. The latest C++ should compile against the trunk. Regards,