On Mon, Jan 16, 2017 at 12:27 PM, Brook Milligan
In the meantime, I have been playing a bit more with the library and would like to reiterate at least one point from my 2017-01-12 email. As far as I can tell, there is no reason to restrict capturing an expression into expression_wrapper<> by moving it. I made another version that copies and it works fine. I have used that with std::reference_wrapper and a special wrapper that I use to wrap rvalues (i.e., it moves those into either itself or onto the heap so that it preserve the reference semantics yet can be copied). Both worked perfectly, can be stored in std::function<>, etc. It would be nice to support the more general use case of an expression_function<> acting as a reference to another expression when constructed from an lvalue. Then it could be used anywhere as a proxy for evaluating any expression. That seems like a really useful feature.
Thanks for bringing this back up! I totally missed it the first time. The move was perhaps a copy/paste error. Zach