[type_traits] Interesting problem with is_base_of.

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 \/\/
participants (1)
-
Seweryn Habdank-Wojewódzki