This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Not Const Temporaries


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
   .  ..   ...  -  ---  ==  ====\ (===) /====  ==  ---  -  ...   ..  .
                                 \_) (_/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]