Boost logo

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

  // move() algorithm tested along with moving back_inserter
  move(foos1.begin(), foos1.end(), back_move_inserter(foos2));

Attaching tested code.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at