Boost logo

Boost Users :

From: OSA (sostrovskiy_at_[hidden])
Date: 2006-01-11 05:08:37


Look at example code:

class CBase
{
public:
        virtual ~CBase(){}

        virtual void foo()const = 0;
};

template <class T> class CTest
{
private:
        BOOST_STATIC_ASSERT((boost::is_base_of<CBase,T>::value_type));
public:
        CTest(){}

        void what()const
        {
        }
};

class CDerived : public CBase
{
        CTest<CDerived> m_a;

public:
        CDerived(){}

        virtual void foo()const{m_a.what();}
};

int main(int argc, _TCHAR* argv[])
{
        CDerived d;
        d.foo();
        return 0;
}

I am using the BOOST_STATIC_ASSERT to make sure the template parameter of the
CTest class is inherited from some specific class (in particular CBase in this
example). But this code is not compiled. I am using Visual C++ 7 compiler. What
is my error?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net