DescriptionAdd Pass(), which implements move semantics, to scoped_ptr, scoped_array, and scoped_ptr_malloc.
This modification to the scopers implements the "moveable but not copyable" semantics that were introduced in C++11's unique_ptr<>.
With this, is now possible to use scopers as an argument type or a return type. This signifies, in the type system, transfer of ownership into a function or out of a function respectively. Calling, or returning such a function MUST use the temporary resulting from the scoper's Pass() function. You CANNOT just pass the scoper by copy as there is still no copy constructor or assignment operator; trying to do so will yield a compilation error.
This distinction makes it possible to avoid the implicit ownership transfer issues of auto_ptr, but still allow us to have compiler enforced ownership transfer.
Also adds a Passed() helper that allows using a scoper with Bind().
BUG=96118
TEST=new unittests
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=113722
Patch Set 1 #Patch Set 2 : Bind() support Implemented #Patch Set 3 : small fixes. #
Total comments: 2
Patch Set 4 : Fix comments, make Passed() support temporaries, fix unbound argument forwarding, add more tests. #
Total comments: 36
Patch Set 5 : Fixed spelling in comments #
Messages
Total messages: 10 (0 generated)
|