Boost logo

Boost Users :

From: Seweryn Habdank-Wojewódzki (shw_at_[hidden])
Date: 2007-09-23 17:51:49


Dears

There are two codes. The first is workig as it is specified in the
documentation, but the second not. Why there are problems with the second
code?

Regards.

// This code works perfectly

#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
#include <boost/utility.hpp>

template <typename B, typename R>
class test
{
public:
    test ()
    {
        BOOST_STATIC_ASSERT((boost::is_base_of<B, R>::value));
    }
};

int main()
{
    test <int, int> t ();
}

// The code belo is not working

#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
#include <boost/utility.hpp>

template <typename B>
class test
{
public:
    template <typename R>
    test (R const &)
    {
        BOOST_STATIC_ASSERT((boost::is_base_of<B, R>::value));
    }
};

int main()
{
    test <int> t (static_cast<int>(0));
}

-- 
|\/\/|   Seweryn Habdank-Wojewódzki
 \/\/ 

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