Boost logo

Boost :

Subject: Re: [boost] [core] [noncopyable] Add nonmoveable?
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-04-26 23:23:36


On 26/04/2017 20:53, Andrey Semashev wrote:
> Yes, but it doesn't remove the dummy namespace from ADL.

As long as no other symbols are defined in that namespace, what does it
matter?

> Deleted copy constructor/assignment have the same property.

Yes, and that's better if you're writing a class that (or in a library
that) otherwise does not depend on Boost in any way. But if you're
taking a dependency on Boost anyway, then boost::noncopyable is less
typing than explicitly deleting constructors.

> That's fine if your design already employs pimpl (or you're willing to
> change it that way). But otherwise why would you want to add a data
> member to implement movability?

If your data members aren't the reason you're constraining movability,
then why do it at all?

And if they *are* the reason you're constraining movability, then you
should separate the memory-management concerns of the class from the
other concerns (SRP), which is where the smart pointer types come in.
It doesn't have to be "true" PIMPL (where the pointer is the only
published member) to take advantage of these behaviours.


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