[LC++]ambiguity, temporaries, const

Roberto Diaz roberto at vivaldi.dhis.org
Mon Jan 7 04:47:04 UTC 2002


On Sat, Jan 05, 2002 at 07:54:09PM +0100, Davide Bolcioni wrote:
> This is a separate issue. If you have:
> 
> 
>    void f(P&) { cout << "By reference\n"; }
>    void f(P) { cout << "By value\n" ; }
> 
> which should the compiler use when it sees:
> 
>    P p;
> 
>    f(p); // Which one ?

Yes I know.. but it would be nice if the standard would had defined something
like "teporaries will be passed by value and the rest by reference whenever
possible" 

Well.. 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