[Insight-developers] Best method for a do-nothing return-value function

M Stauffer (V) mstauff at verizon.net
Fri Dec 17 18:09:34 EST 2010


Hi,

I'm not sure how to phrase the subject. I'm creating a function base
class whose "Evaluate", i.e. do-its-thing, method needs to simply return
the input value. Derived classes will modify the value in some way, not
surprisingly.

Is there a more efficient way to implement this than what I have below?
I figure most compilers will actually make this inline, but maybe not
all? 

< typename TValue >
class FunctionBase {

...
  inline TValue Evaluate( TValue value ) { return value; }
...

};



More information about the Insight-developers mailing list