John Maddock wrote:
1) Why on earth is:
BOOST_CONSTEXPR noncopyable() = default;
Better than
noncopyable() {}
I can tell you what's the difference, but not why it's better. :-) constexpr on the constructor enables noncopyable, and its descendants, to be statically initialized. I suppose this makes sense; a mutex, for example, is noncopyable but it may be desirable for it to support static initialization. =default makes the constructor trivial. A trivial constructor can be omitted. It's not clear to me why a noncopyable class would need to have a trivial constructor. Similarly, =default on the destructor instead of {} makes it trivial. A trivial destructor may be omitted. It makes approximately zero sense for a noncopyable class to have a trivial destructor. The funniest part is that =delete on the copy constructor makes the copy constructor trivial as well, in C++11. A trivial copy constructor means that the class is copyable with memcpy. :-) (There is a core defect report against that though, if I'm not mistaken.) In summary, I don't see the new noncopyable as better than the old one in any significant way.