[Insight-developers] RE: FunctionBase

Brad King brad.king@kitware.com
Tue, 18 Sep 2001 20:38:59 -0400 (EDT)


Josh,

> For example, If I'm evaluating ax+b, a and b should not change as a
> result. Similarly the value x is passed through a const parameter
> ( evaluate(const int x) const {...} )  so that it is guaranteed not to be
> modified as a result of the function call.
One minor detail here is that top-level cv-qualifiers are ignored by the
compiler for a function or method interface.  Since "int x" is
copy-initialized from the input argument, there is no way an assignment to
it in the function body will modify the original argument.

In the case of "const int& x", there are no top-level cv-qualifiers
because the reference is the top level, and it is a reference to
"const int".  In this case, the const qualifier does matter.

-Brad