Subject: Re: [boost] [core/noncopyable][test/boost::unit_test::singleton]massive test failures
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-08-21 09:53:46
On Thursday 21 August 2014 16:26:06 Peter Dimov wrote:
> Andrey Semashev wrote:
> > Why do you think it's not sensible to have a trivial default
> > constructor/destructor for a non-copyable class?
> Because it isn't. Think about it. Trivial constructors and destructors do
> nothing at all. A trivial constructor leaves the object uninitialized.
> But it's possible I'm constrained by my lack of imagination; show me one
For example, an object that is supposed to be initialized by a method call.
The initialization is not done in the constructor because the object is
supposed to be declared in the namespace scope and not pose thread safety
issues. A global mutex, for instance.
Another example, a global placeholder used as an anchor for DSL expressions or
something like that. Think of something similar to std::cout.
> > Technically, you can apply memcpy to any object and deal with the
> > consequences.
> Technically... if an object has a trivial copy constructor it's well defined
> to use memcpy to copy it. See 3.9/3.
Right, I'm not arguing with that.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk