Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > non-const reference to temporary object

Thread Tools

non-const reference to temporary object

James Kanze
Posts: n/a
On Nov 27, 6:44 pm, (E-Mail Removed) wrote:
> > The real question is why he wants to bind the temporary to a
> > non-const reference. There are several legitimate uses, but
> > each has a somewhat different effective work-around.

> I was using a Symbian C++ macro to generate a descriptor (
> temporary ) and was trying to write it to a file using a
> function which took a non-const parameter. Probably not the
> right place to discuss.

Yes and no. The question in this case is why a function which
writes the object to a file takes a non-const reference.

James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
anonymous array of strings // ("taking address of temporary"- how long is temporary valid?) C++ 7 02-12-2008 10:58 AM
reference to the temporary object Raider C++ 3 06-22-2006 03:34 PM
Const reference to a temporary object - Why? Dave Rahardja C++ 15 11-03-2005 03:45 AM
Type conversion of reference to a temporary object Stefan Strasser C++ 2 03-28-2005 09:52 PM
A reference to non-const to be bound to a temporary object John Ky C++ 9 02-23-2004 12:53 AM