Boost logo

Boost :

Subject: Re: [boost] Composing non copyable and movable classes
From: David Abrahams (dave_at_[hidden])
Date: 2008-12-08 16:56:28

on Sun Dec 07 2008, "Emil Dotchevski" <> wrote:

> On Sat, Dec 6, 2008 at 4:42 PM, David Abrahams <dave_at_[hidden]> wrote:
>> This feels like overgeneralizing. Unless otherwise justified, every
>> type should have value semantics, i.e., should be movable and copiable.
> I find C-style incomplete type (and therefore non-copyable,
> non-movable and non-value) handles quite practical too:
> //foo.h
> namespace boost { template <class> class shared_ptr; }
> struct handle;
> boost::shared_ptr<handle> create_handle();
> void do_something( handle & );

The type playing the role of handle in this case (at least according to
the traditional meaning of "handle") is shared_ptr<handle>, which is
both movable and copyable.

Also the incompleteness of the struct is usually "otherwise justified"
in such a case.

Dave Abrahams
BoostPro Computing

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