help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing temporary storage as a non-const parameter to a function


From: Ralf Fassel
Subject: Re: passing temporary storage as a non-const parameter to a function
Date: Tue, 09 Nov 2004 10:44:33 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux)

* jjleto <address@hidden>
| error: invalid initialization of non-const reference of type
| 'std::string&' from a temporary of type 'std::string' (gcc 3.3.4)
--<snip-snip>--
| How do I handle this ?

Workaround: Create the temporary yourself.

   string tmpstring("foo");
   f2(tmpstring);

R'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]