Boost logo

Boost :

From: Vadim Zeitlin (vz-boost_at_[hidden])
Date: 2005-08-17 06:36:47

On Wed, 17 Aug 2005 12:25:14 +0100 Martin Bonner <martin.bonner_at_[hidden]> wrote:

MB> > Vadim Zeitlin wrote:
MB> >> Hello,
MB> >>
MB> >> when compiling <boost/algorithm/string/trim.hpp> with MSVC 7.1 at
MB> >> maximal warning level you get a warning 4512 ("assignment operator
MB> >> could not be generated") because of the const members in struct
MB> >> is_classifiedF from boost/algorithm/string/detail/classification.hpp.
MB> >>
MB> >> The trivial patch below fixes it.
MB> > Wouldn't it be even better to provide a new baseclass
MB> > boost::nonassignable that is similar to boost::noncopyable ? That
MB> > makes things even more explicit.
MB> >
MB> That wouldn't help. If you derive from boost::noncopyable, you get warning
MB> 4512 (because MSVC is unable to generate an assignment operator).

 Indeed, sorry for forgetting to mention about this.

MB> I think the best fix is for users to #pragma off the warning.

 Why? The warning can sometimes be useful and it doesn't cost much to work
around it. Of course, I do disable it for now but I try to exhaust all the
other alternatives before doing it and here it seems to be well possible to
fix the warning in the header without any adverse effects.

 However if the decision is that the proper solution is to use the #pragma,
then I'd still like to have this #pragma inside boost header(s) instead of
forcing the users to pepper their code with it. I can provide a patch for
this too, of course, but basically it is as simple as adding

#ifdef _MSC_VER
  #pragma warning(disable:4512)

before and

#ifdef _MSC_VER
  #pragma warning(default:4512)

after the offending struct.


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