Boost logo

Boost :

Subject: [boost] [compute] Define user functions using lambda expressions
From: Asbjørn (lordcrc_at_[hidden])
Date: 2014-12-22 16:54:39


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.

- Asbjørn

Boost list run by bdawes at, gregod at, cpdaniel at, john at