Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-07-08 08:59:04


From: "David Abrahams" <david.abrahams_at_[hidden]>
> > I (almost) never impose my opinion of whether a warning is useful or not
> on
> > users, when I can avoid it.
>
> If you are intent on that, there is always
>
> #pragma warning(push)
> #pragma warning(disable: 4511 4512)
> ...
> #pragma warning(pop)

OK, let's compare the alternatives:

[1]

class X // noncopyable
{
public:

// ...

private:

// ...

    X(X const &);
    X & operator= (X const &);
};

[2]

#include <boost/noncopyable.hpp>

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4511) // copy constructor not generated
#pragma warning(disable: 4512) // assignment not generated
#endif

class X: private noncopyable
{
public:

// ...

private:

// ...

}

#ifdef _MSC_VER
#pragma warning(pop)
#endif

--
Peter Dimov
Multi Media Ltd.

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