22 Dec
2014
22 Dec
'14
10:51 p.m.
On Mon, Dec 22, 2014 at 1:54 PM, Asbjørn
Hi,
I'm probably missing something obvious, but how would I go about making a custom function using a lambda expression? Say I want to declare some function "sqr" which returns "_1 * _1", and then use this in a transform() lambda expression, ie
transform(..., 2.0 * sqr(_1) - 3.0 * _1 + 5.0, ...);
to evaluate 2x^2 - 3x + 5.
If I try to use BOOST_COMPUTE_FUNCTION() I can't use the resulting function in a lambda expression it seems.
Unfortunately, calling user-defined functions from lambda-expressions is not currently supported. See issue #59 [1]. However, this is something I'd like to support, I just haven't had the time to implement it yet. -kyle [1] https://github.com/kylelutz/compute/issues/59