Boost logo

Boost Users :

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://lists.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/

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