
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
on 30.10.2009 at 1:02 joel wrote : 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