Boost logo

Boost :

Subject: Re: [boost] [core] [noncopyable] Add nonmoveable?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-04-25 10:23:38


On 04/25/17 13:10, Viktor Sehr via Boost wrote:
> In addition to noncopyable, I sometimes want to force classes to be
> nonmoveable as well (mainly node-type classes in tree structures which
> other classes point to). Therefore I'd suggest adding a cousin to
> noncopyable; boost::nonmoveable which simply prevents an instance to be
> nonmoveable (as well as noncopyable).
>
> Note; even due the delete modifier were added in C++11 I still think
> inheriting boost:noncopyable\nonmoveable syntactically nicer than manually
> marking the copy\move constructors\assignment operators delete.

I think in C++11 noncopyable should be considered deprecated and
generally avoided. It affects class hierarchy, adds an extra namespace
to ADL and may not be optimized away with EBO. I would even avoid it in
C++03 as well. It follows that nonmoveable makes no sense in C++11. Just
use the language features you have.


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