Boost logo

Proto :

Subject: Re: [proto] How to prevent function to be called for every evaluation of an expression?
From: Bart Janssens (bart_at_[hidden])
Date: 2013-08-16 05:15:34


On Fri, Aug 16, 2013 at 9:43 AM, Ole Svensson <o.svensson_at_[hidden]> wrote:
> when I call
> proto::display_expr( b + c + dotProduct(b,c) );
> the AST that is printed does not include some kind of function node but the
> return value of dotProduct(b,c) -- i.e., some number.

Hi Ole,

What exactly is dotProduct? Is it a C++ function? If so, it will just
get evaluated and the AST will contain the result of the evaluation.
In that case I would expect it to only get evaluated once. How are you
checking that it gets called multiple times? You might try setting a
breakpoint in dotProduct and check where it gets called from.

Cheers,

Bart


Proto list run by eric at boostpro.com