Boost logo

Boost Users :

Subject: Re: [Boost-users] scoped_ptr::release (again)
From: Matthieu Brucher (matthieu.brucher_at_[hidden])
Date: 2009-02-24 14:21:33


2009/2/23 Alexander <gutenev_at_[hidden]>:
>> WFM...
>>
>> void foo(scoped_array<int> &b) {
>>  scoped_array<int> a(new int[5]);
>>  swap(a,b); // escape
>> }
>
> Hm.. I agree with you that having swap to escape scoping but not having
> release looks inconsequent. In my opinion there should be no swap either.

Without swap(), there will be need for another smart pointer. I use
swap to swap two array pointers (so I'm using scoped_array) in my
computations. Without it, I don't know how I would write it in an
efficient way.

Matthieu

-- 
Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher

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