Subject: Re: [Boost-users] scoped_ptr::release (again)
From: Yang Zhang (yanghatespam_at_[hidden])
Date: 2009-02-22 17:11:26


Alexader wrote:
>> But there already is a way to escape the scope, via swap().
>
> How ?
> I thought scoped_ptr was to prohibit swap either.
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://listarchives.boost.org/mailman/listinfo.cgi/boost-users

WFM...

void foo(scoped_array<int> &b) {
   scoped_array<int> a(new int[5]);
   swap(a,b); // escape
}

-- 
Yang Zhang
http://www.mit.edu/~y_z/