[LC++]ambiguity, temporaries, const

Roberto Diaz roberto at vivaldi.dhis.org
Sun Jan 6 04:39:04 UTC 2002


On Sat, Jan 05, 2002 at 05:39:31PM +0100, Davide Bolcioni wrote:
> > 		* Theres not ambiguity in f(P&) and f(const P&)
> It is supposed to work that way; it is useful to be able to 
> 
> "overload on const" (and volatile) the same function. This means
> that:
> 
>    void f(P &);
>    void f(P const &);
>    void f(P volatile &);
>    void f(P const volatile &);
> 
> are four separate functions.

What I actually was trying to mean is that for instance if I overload this way:

(I really was trying to pass temporaries and non-temporaries to the same
function (name) without the use of pointers)

void f (P&); 
void f (P);

I get errors.. I suppose it is not possible to overload this way..

Thank you!.

-- 
Saludos

Roberto Díaz <roberto at vivaldi.dhis.org>

PLEASE HELP SAVE faqs.org!
http://www.faqs.org/save_faqs-org.html



More information about the tuxCPProgramming mailing list