Subject: Re: [proto] How to prevent function to be called for every evaluation of an expression?
From: Ole Svensson (o.svensson_at_[hidden])
Date: 2013-08-16 07:08:22
> 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.
I must apologize: because of my messy prototype code layout I forgot that -- in order to benchmark my program -- I evaluated the expression several thousand times; hence the function dotProduct got called that often.
But of course you are correct: for every evaluation of the vector expression it gets called only once.
Thank you very much!
Proto list run by eric at boostpro.com