Boost logo

Boost :

Subject: Re: [boost] noncopyable && C++11
From: Ben Pope (benpope81_at_[hidden])
Date: 2012-07-06 04:01:54


On Friday, July 06, 2012 03:26 PM, Ben Pope wrote:
> boost::noncopyable interferes with the implicit generation of move

Hmm, I see this was discussed before:
http://lists.boost.org/boost-users/2011/07/69621.php

Which I failed to find first time I searched.

There is still the case where I want to prevent copying (but allow
moving), and boost::noncopyable was what I used before move semantics.

I guess we could have:

    class moveonly
    {
    protected:
       moveonly() = default;
       moveonly(moveonly&&) = default;
       moveonly& operator=(moveonly&&) = default;
       // implicit
       // moveonly(moveonly const&) = delete;
       // moveonly& operator=(moveonly const&) = delete;
    };

So that there is an expressive and concise form of "I want this to have
default move semantics without being copyable".

Ben


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