Can\'t find much on that for C++11 but only on boost.
Consider the following class:
class State
{
std::shared_ptr _graph;
public:
If you want to make a copy of the Graph
object when you make a copy of the object, you can always define your copy constructor and assignment operator to do just that:
State::State(const State& rhs) : _graph(std::make_shared(*rhs._graph)) {
// Handled by initializer list
}
State::State(State&& rhs) : _graph(std::move(rhs._graph)) {
// Handled by initializer list
}
State& State::operator= (State rhs) {
std::swap(*this, rhs);
return *this;
}
Hope this helps!