From -7564379223574507547
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,a1bad1ffc4f79f48
X-Google-Attributes: gidf78e5,public
Path: g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.159.246.34.MISMATCH!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: tom_usenet@hotmail.com (tom_usenet)
Newsgroups: comp.std.c++
Subject: Re: Idea for calling multiple methods on a single object.
Date: Wed, 9 Jun 2004 17:07:25 +0000 (UTC)
Lines: 36
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <2vldc0hnim3jnkh5hl91khei6ulhsvqfle@4ax.com>
References: <194c1211.0406060903.6731d4ee@posting.google.com> 
    <1a0929fa.0406070510.de6c30d@posting.google.com> 
    <5b15f8fd.0406080035.29d5f2f8@posting.google.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: mail2news.demon.co.uk 1086800845 27365 10.0.0.1 (9 Jun 2004 17:07:25 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 9 Jun 2004 17:07:25 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 1BY6Xs-00077E-00
	for mail2news@news.news.demon.net; Wed, 09 Jun 2004 17:07:24 +0000
X-Received: from mulga.cs.mu.OZ.AU (localhost [127.0.0.1]) by mulga.cs.mu.OZ.AU with ESMTP
	id i59H7MB5014322; Thu, 10 Jun 2004 03:07:22 +1000 (EST)
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i59H7Mdq014312;
	Thu, 10 Jun 2004 03:07:22 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-Newsgroups: comp.std.c++
X-OriginalArrivalTime: 09 Jun 2004 09:29:49.0875 (UTC) 
    FILETIME=[4FCAE830:01C44E04]
X-Spam-Checker-Version: SpamAssassin 2.60-mulga_r1 (1.212-2003-09-23-exp) on 
	mulga.cs.mu.OZ.AU
X-Spam-Level: 
X-Spam-Status: No, hits=-2.5 required=5.2 tests=AWL,BAYES_00,
	FORGED_HOTMAIL_RCVD2 autolearn=ham version=2.60-mulga_r1
Xref: g2news1.google.com comp.std.c++:736

On Tue, 8 Jun 2004 17:58:55 +0000 (UTC), dietmar_kuehl@yahoo.com
(Dietmar Kuehl) wrote:

>richard@ex-parrot.com (Richard Smith) wrote:
>> So use a reference:
>> 
>>   Type const& tmp = foo();
>>   tmp.method1();
>>   tmp.method2();
>
>Note that this means that 'method1()' and 'method2()' can only be
>'const' methods. This can be a serious restriction.

How about this:

Type const& tmpHolder = foo(); //needed for lifetime extension
Type& tmp = const_cast<Type&>(tmpHolder); //Mmmm, nice.
tmp.method1();
tmp.method2();

Or even this:

Type&& tmp = foo(); //will rvalue references extend lifetime?
//...

Tom
-- 
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



