On 08/21/2014 06:08 AM, Peter Dimov wrote:
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. <snip>
I'm pretty sure that the BOOST_CONSTEXPR here is spurious. If a defaulted constructor can be constexpr, it is, and you don't have to say it. So: noncopyable() = default; ... is sufficient. And IIRC, that was a late change, so there *may* be compilers that get this wrong. But that I don't know.