|
Boost : |
Subject: Re: [boost] Temporary objects
From: DE (satan66613_at_[hidden])
Date: 2009-10-30 15:49:10
on 30.10.2009 at 1:02
joel wrote :
> What about a good read on Named Return Value Optimization and the
> upcoming move features ...
afaik nrvo is not implemented in msvc80
certainly it would be nice to have such but with current standard it
is very hard to implement it because it is very hard to statically
analyse the code of copy constructor and assignment operator
i mean either the standard would be broken or the optimized code might
produce unexpected behavior, e.g. where you expect 2 copy constructors
there is only 1 etc.
i live in real world (i.e. with c++98 standard) and propose very simple
yet efficient and complete (in several scope) solution
while nrvo is not guaranteed (again afaik) to take place this approach
will always (!) work if it is explicitly stated so
i'm not familiar with upcoming move features but my guess is that it
will be some nerdy metaprogramming (no offence guys) while i propose
almost trivial solution which can be started using right now without
even changing classes (structs) definitions
-- Pavel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk