Pimpl copying
Guillaume Laurent
glaurent at telegraph-road.org
Fri Jul 14 15:44:57 BST 2006
On Friday 14 July 2006 11:55, Reinhold Kainhofer wrote:
> Am Freitag, 14. Juli 2006 11:28 schrieb Lubos Lunak:
> > On Friday 14 July 2006 10:33, André Wöbbeking wrote:
> > > On Thursday 13 July 2006 23:05, Peter Kümmel wrote:
> > > > void KTempDirTest::testBasic()
> > > > {
> > > > - KTempDir dir = KTempDir("test");
> > >
> > > normal ctor and then copy ctor
> >
> > No. It's just syntactic sugar functionally completely equivalent to the
> > case below with just normal ctor. If any compiler uses copy ctor here
> > it's broken.
>
> Stroustrup's book says that
> KTempDir dir = KTempDir("test");
> and
> KTempDir dir("test");
> are equivalent. I.e. the first one should not use ctor and then copy.
Where does it say this ? AFAIR, it says that in this case, the copy *can* be
optimised away (11.7 - I'm pretty sure there are other references but I can't
find them), not that it will.
--
Guillaume.
http://www.telegraph-road.org
More information about the kde-core-devel
mailing list