Not Const Temporaries

Philippe Cizaire pci@silicomp.com
Thu May 3 04:56:00 GMT 2001


Alexandre Oliva wrote:
> 
> The problem is that you've got a temporary of type TKeeper, but a
> temporary can't be bound to a non-const reference.
> 
> If it's impossible to arrange for the copy constructor to take a const
> reference, you'll have to introduce a member function that returns
> `*this' by reference, and call it in order to be able to bind the
> lvalue to a non-const reference.

Thank you for your answer, 

It works fine (but it costs me 2 uneeded temporaries that lead to at
least 4 syscalls... snif).

Is there a way to tell gcc to accept to take non const reference to
temporaries ?

Thank you again for your help,

Regards.
-- 
                                   \|/      Philippe Cizaire
                                  (o o)       
 . ..  .. -  --  ----  ==  ===oOO==(_)==OOo===  ==  ----  --  - ..  .. .
  High speed, Plug And Play,                pci@silicomp.com
 WWW KoMpAtIbLe, Java++, FT,   .ooo0 0ooo.  Tel. +33 687 74 54 54  
 CORBA 5.9 Compliant and more  (   ) (   )  Fax. +33 476 41 66 67
   .  ..   ...  -  ---  ==  ====\ (===) /====  ==  ---  -  ...   ..  .
                                 \_) (_/



More information about the Gcc-help mailing list