|
Boost : |
From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-03-17 08:26:06
Alexei Alexandrov ha escrito:
> JoaquÃn Mª López Muñoz <joaquin <at> tid.es> writes:
>
> >
> > I could avoid these warnings in Boost.MultiIndex, but I'm not sure this
> > is the right thing to do, as the problem is really Boost-wide and should
> > be considered, IMHO, from a global point of view: any class using
> > boost::noncopyable will make MSVC level 4 shout, try the following
> > for instance:
>
> The example you provided compiles without a warning with "cl -c -W4 test.cpp".
Ummm... it shows C4511 and C4512 in MSVC 6.5. Maybe MSVC 7.1 is
smarter.
> So the problem is somewhat more specific perhaps?
The problem is, one way or another, related to the noncopyable idiom (deriving
from a class with private copy ctr and assignment operator.) Maybe the
following, more convoluted snippet will MSVC 7.1 emit the warning:
#include <boost/noncopyable.hpp>
class bar:boost::noncopyable
{
};
template<typename T>
class foo:bar
{
public:
foo(int x=0);
};
foo<int> f;
Even it doesn't, my point remains that this is a problem likely to be
distributed across the whole Boost codebase. And that it is IMHO
a nonsense warning, since lacking automatically generated copy
ctor and assignment operator cannot AFAICS lead to inadvertent
errors.
Joaquín M López Muñoz
Telefónica, Inevstigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk