Boost logo

Boost :

Subject: Re: [boost] [interprocess] default constructors
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-11-30 07:25:16


Giovanni Piero Deretta wrote:
> On 11/30/08, Ion Gaztañaga <igaztanaga_at_[hidden]> wrote:
>> Jan Stetka wrote:
>>
>>> I'm don't known what "move semantics" are, my motive is so I can have
>> named_mutex and managed_shared_memory in the global scope without having to
>> instantiate as pointers.
>> In other words, you want to create a default-constructed type and then swap
>> it with a named constructed one when you have enough data to build a named
>> object?
>
> IMHO for this purpose boost.optional + inplace factory is the best solution.

Yes, this is a good solution. However, some prefer having a default
constructed state (that only can be modified through swapping or move
semantics), since you already need it to implement a private
"default-constructed state" to correctly implement the destructor.

Regards,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk