|
Boost : |
Subject: Re: [boost] [move][container] Review Request (new versions of Boost.Move and Boost.Container in sandbox and vault)
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-08-12 15:53:53
David Abrahams escribió:
> Only in assignments?
>
> what about
>
> consume(produce())
>
> scenarios?
obj produce() { return obj(); }
void consume(obj ){}
int main()
{
consume(produce());
return 0;
}
At least in MSVC 7.1, GCC 4.3 and Intel 10.0 (which is EDG 3.8,
http://software.intel.com/en-us/articles/intel-c-compiler-for-windows-general-compatibility-with-other-products/#17)
this produces just a default constructor and no calls to copy
constructor. And the same happens with:
obj o = produce();
and
obj o(produce());
>> This is not the case with constructors (the original Klaus Triendl proposal included
>> them, http://lists.boost.org/Archives/boost/2009/06/153266.php) because it terribly
>> uglifies syntax
>
> Are you sure you've looked at all the alternatives? Every move library
> I'm aware of before yours supports implicitly move constructing from
> non-const rvalues.
Well, I can't say I've looked all of them ;-). I think this alternative
is one of the most balanced ones, and allows writing optimal code for
c++0x compilers without creating temporaries.
Regards,
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk