
I've the following template function: template<typename T> T exp2(const T T0_d) { return exp(0.5*T0_d) + 2*exp(T0_d); } I want to define this as a lambda function in place (but don't know how). It will be used with T=double and T=MyAutomaticDerivativeClass. I've already defined the return type of arithmetic operators applied to MyAutomaticDerivativeClass: namespace boost { namespace lambda { template<class Act, typename X, typename Y> struct plain_return_type_2<arithmetic_action<Act>, X, Y> { typedef ... type; }; } } What else is missing? Thanks Peter

"Peter Foelsche" <peter_foelsche@agilent.com> wrote in message news:hef6ot$dnj$1@ger.gmane.org... see attached. Is there no simpler way? I especially dislike having to know the type of the argument. And I would need to write one class for every math function. Peter

On Mon, Nov 23, 2009 at 6:40 PM, Peter Foelsche <peter_foelsche@agilent.com> wrote:
"Peter Foelsche" <peter_foelsche@agilent.com> wrote in message news:hef6ot$dnj$1@ger.gmane.org...
see attached. Is there no simpler way? I especially dislike having to know the type of the argument. And I would need to write one class for every math function.
You might look at Boost.Phoenix2 (in the Boost.Spirit section), it can do what you want (it can do everything Lambda can and more).
participants (2)
-
OvermindDL1
-
Peter Foelsche