IMHO the pipe syntax should just be a shorthand for (left associative) function application, i.e.:
x | f
should simply be a equivalent to
f(x)
+1 -
I would like to see it as a utility library for composing unary function objects whose arguments and return types match up. It's to interesting and useful to be part of boost range. Taking it out of boost.range would also simplify boost range.
Is it possible to implement this in general without having to write a wrapper for each function to be used in this way? I don't think so because operator overloading requires at least one of the arguments to be user-defined, and x could be a built-in type and f a plain function pointer. I suppose we could have a utility library that defines a macro to generate the wrapper, but then libraries like Boost.Range would still need to provide code that calls this macro. Regards, Nate