What about type traits, to ask the type system exactly those questions? using directed_graph_t = adjacency_list<>; is_move_constructible<directed_graph_t>(); is_move_assignable<directed_graph_t>(); For the record, both are true. Hope that helps, Daniel J H On 12/02/2015 03:47 AM, Paolo Bolzoni wrote:
Dear list,
I am writing a program where I create a graph first and I want to put it inside another class instance (type T). The idea is to keep the two steps separated as possible.
Normally, sure-fire way was using swap. Inside the class T you create a default object and swap it with the real one on initialization; this avoids needless copies and just construct a small object.
Nowadays, it is also possible to use moveable objects to even avoid that object creation.
This is nice and I (think I) understood it, but it is possible to do anything like this with boost graphs? Graphs don't model Assignable, so swap is not possible, and I could not find anything about being Moveable either.
Is there really no way to accomplish a swap or a move? I just have to create the graph in the beginning, and keep a reference, or pointer, to it?
Cheers, Paolo _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users