Const in default function arguments?

John Love-Jensen eljay@adobe.com
Fri Apr 4 12:32:00 GMT 2003


Hi Eric,

>Why won't the non-const version compile?

Because by making it a non-const reference, you are saying that you are
going to modify it.  That is to say, you are making an "OUT" or "UPDATE"
(in/out) parameter.

When you specify a default object, you are making a temporary.

It doesn't make sense to modify a temporary.

--Eljay



More information about the Gcc-help mailing list