Boost logo

Boost :

From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2001-09-28 11:39:28


> When using boost::scoped_ptr or boost::scoped_array on MSVC 6.0 SP4
> with warning level /W4, I get the following warnings about subclasses
> of boost:noncopyable not defining (private) copy constructors and
> assignment operator.

[snip]

> d:\foobar.cpp(66) : see reference to class template
> instantiation 'boost::scoped_ptr<class foobar>' being compiled
> d:\boost_1_24_0\boost\smart_ptr.hpp(96) : warning
> C4511: 'scoped_ptr<class foobar>' : copy constructor could not be
> generated

[snip]

> The fix for these warnings is simply to define a private copy
> constructor and assignment operator for boost::scoped_ptr and
> boost::scoped_array. For example:

Doesn't this 'fix' entirely defeat the purpose of boost::noncopyable,
which is to avoid having to do this explicitly?

Seems to me that this warning is very unuseful, since it really is not
a problem in a well-formed program unless, of course, that copy
constructor or copy assignment is used somewhere, in which case *that*
code should generate an error, not just a warning. I would recommend
just turning this warning off, period.

George Heintzelman
georgeh_at_[hidden]


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