Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2005-08-17 06:25:14


----Original Message----
From: Stefan Seefeld [mailto:seefeld_at_[hidden]]
Sent: 17 August 2005 11:59
To: boost_at_[hidden]
Subject: Re: [boost] patch to silence a MSVC++ warning in trim.hpp

> Vadim Zeitlin wrote:
>> Hello,
>>
>> when compiling <boost/algorithm/string/trim.hpp> with MSVC 7.1 at
>> maximal warning level you get a warning 4512 ("assignment operator
>> could not be generated") because of the const members in struct
>> is_classifiedF from boost/algorithm/string/detail/classification.hpp.
>>
>> The trivial patch below fixes it. Notice that I didn't take the
>> assignment operator in "#ifdef _MSC_VER" because I see no harm in
>> doing this for all compilers but then no other compiler I know about
>> gives such warning so it should be also safe to add the #ifdef if
>> this is preferred.
>
> Wouldn't it be even better to provide a new baseclass
> boost::nonassignable that is similar to boost::noncopyable ? That
> makes things even more explicit.
>
That wouldn't help. If you derive from boost::noncopyable, you get warning
4512 (because MSVC is unable to generate an assignment operator).

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

-- 
Martin Bonner
Martin.Bonner_at_[hidden]
Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ,
ENGLAND Tel: +44 (0)1223 441434

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