Boost logo

Boost Users :

Subject: [Boost-users] [Container] Forward declaration of movable types
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2011-08-16 09:00:24


Hi,

I am evaluating container library by Ion Gaztanaga. I know it is not
officially a part of boost yet but I didn't know where else to ask
this question.

My problem:

If there is a movable class 'MyMovable' (I use boost.move) it can be
stored without unnecessary copies in move-aware vector that is
declared like so:

vector<MyMovable> movables;

which is very cool until this vector is suppose be a member of other class like:

//widget.hpp

class Widget
{
  vector<MyMovable> movables_;
};

which is not cool at all because now widget.hpp must include
my_movable.hpp as opposed to just forward declaring it if it stored
say vector<shared_ptr<MyMovable>> which in turn makes movability of
MyMovable rather useless.

I guess my question is: how can one take advantage of move semantics
in context of member containers without adding unnecessary class
dependencies?

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