|
Boost Users : |
Subject: Re: [Boost-users] [Move] unique_ptr
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2011-10-31 13:59:10
Hi again,
>
> Imho easiest to adopt would be Hinant's implementation:
>
replying to myself, I know, but wanted to share ;)
Just played with modified Hinant's and Ion's (sorry for not crediting earlier
just noticed your name in copyright's info) and it all seems to work properly.
My simple test code:
int main()
{
using namespace boost;
// Foo is marked MOVABE_BUT_NOT_COPYABLE
unique_ptr<Foo> f1(new Foo), f2(new Foo), f3(new Foo);
container::vector<unique_ptr<Foo> > foos1, foos2;
// moving from named pointers
foos1.push_back(move(f1));
foos1.push_back(move(f2));
foos1.push_back(move(f3));
// move() algorithm tested along with moving back_inserter
move(foos1.begin(), foos1.end(), back_move_inserter(foos2));
std::cin.get();
}
Attaching tested code.
Regards,
Simon
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