Boost logo

Boost Users :

From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2008-08-18 05:51:15


2008/8/18 Christian Larsen <contact_at_[hidden]>

> Roman Elitetroppers skrev:
>
>> 2008/8/17 Christian Larsen <contact-AT-dword.dk <mailto:
>> contact-AT-dword.dk>>
>>
>> class A
>> {
>> public:
>> A(auto_ptr<B>& b1, auto_ptr<B>& b2)
>>
>> Pass arguments by value here instead of by reference. It's a common idiom
>> that is used to enforce and document the fact that function takes ownership
>> of arguments.
>>
>
> Ah yes, I see. There is of course no indication in this declaration that
> the function actually calls release on the pointers. But couldn't it
> possibly result in an extra copy being made? (Unless of course it is
> optimized away, which I hope it is.)
>

I guess it could. But I would call it 'move' instead of copy, which is
cheap.

Roman.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net