|
Boost Users : |
Subject: Re: [Boost-users] BGL, swap or move graphs
From: Paolo Bolzoni (paolo.bolzoni.brown_at_[hidden])
Date: 2015-12-02 21:01:40
Is that really trustworthy? I mean, you can also swap two graphs, but
it won't work on some cases.
On Wed, Dec 2, 2015 at 7:29 PM, Daniel Hofmann <daniel_at_[hidden]> wrote:
> 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_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
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