Boost logo

Boost :

Subject: Re: [boost] [compute] Define user functions using lambda expressions
From: Kyle Lutz (kyle.r.lutz_at_[hidden])
Date: 2014-12-22 17:51:30


On Mon, Dec 22, 2014 at 1:54 PM, Asbjørn <lordcrc_at_[hidden]> wrote:
> 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk