This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Not Const Temporaries
- To: Alexandre Oliva <aoliva at redhat dot com>
- Subject: Re: Not Const Temporaries
- From: Philippe Cizaire <pci at silicomp dot com>
- Date: Thu, 03 May 2001 13:56:20 +0200
- CC: Philippe Cizaire <pci at silicomp dot fr>, gcc-help at gcc dot gnu dot org
- Organization: Silicomp AppliBus
- References: <3AF03354.6558@silicomp.com> <or7kzy8z0r.fsf@guarana.lsd.ic.unicamp.br>
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
. .. ... - --- == ====\ (===) /==== == --- - ... .. .
\_) (_/