Boost logo

Boost Users :

From: Daniel van der Zee (zee_at_[hidden])
Date: 2002-06-05 16:59:26

You usually use private inheritance for boost::noncopyable, that should
prevent users from casting to boost::noncopyable.

The boost::noncopyable destructor is also protected and *can* only be called
by a derived class.

    class X : private boost::noncopyable {
        X() { }
        virtual ~X() { }

    int main() {
      boost::noncopyable* x =
           reinterpret_cast<boost::noncopyable*>(new X());
      delete x;

Should give a compile time error like

         cannot access protected member declared in class


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at