Boost logo

Boost :

Subject: Re: [boost] [interprocess] shared_memory_object design
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-08-27 15:25:30

Christian Henning escribió:
> Hi there, a colleague of mine is questioning the design decisions in
> the shared_memory_object class. The assignment operator and copy
> constructor are private. Why?

Because the class own a unique resource just like a file. Is fstream
copyable? No, movable (in c++0x) just like shared_memory_object. What
should the copy constructor do?

Also the constructor takes a type
> instead of a value as the first parameter. In his eyes it makes it
> very inflexible since the creation of or attaching to shared_memory
> area has to known at compile time.

Ok, this is debatable, because with move semantics you can write:

shared_memory_object obj(create?
                        shared_memory_object(create_only, ...):
                         shared_memory_object(open_only, ...));


shared_memory_object shm;

    shared_memory_object tmp(create_only);
    shared_memory_object tmp(open_only);



Boost list run by bdawes at, gregod at, cpdaniel at, john at