Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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/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), 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.



Now Oven is fortunately maintained by awesome hackers in Japan. The latest C++ should compile against the trunk.

Regards,




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: