Boost logo

Boost :

Subject: [boost] noncopyable && C++11
From: Ben Pope (benpope81_at_[hidden])
Date: 2012-07-06 03:26:59


Hi all,

boost::noncopyable interferes with the implicit generation of move
construction and move assignment, so I was wondering if anybody had any
thoughts on something like this:

    class noncopyable
    {
    protected:
       noncopyable() = default;
       noncopyable(noncopyable&&) = default;
       noncopyable& operator=(noncopyable&&) = default;
       noncopyable(noncopyable const&) = delete;
       noncopyable& operator=(noncopyable const&) = delete;
    };

Which would replace the existing technique when C++11 support is on.

I guess it could be argued that non copyable should imply non moveable.

However, you won't hear me defending that position; plenty of thought
went into move semantics with the defaults chosen to have sa[f|n]e
behaviour. The derived class will still be subject to that criteria, I'm
just trying to prevent noncopyable from artificially inhibiting move
semantics.

Would anybody want nonmovable? nonmoveable?

Any thoughts / comments / omissions gratefully received.

Ben


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