Boost logo

Boost :

Subject: Re: [boost] [core/noncopyable][test/boost::unit_test::singleton] massive test failures
From: Eric Niebler (eniebler_at_[hidden])
Date: 2014-08-21 13:43:03

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.

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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at