
21 Aug
2007
21 Aug
'07
10:14 a.m.
Hughes, James wrote:
Hello all,
I want some template code to assert if the passed in template type is NOT derived from a particular base class.
I've looked through the Template Metaprogamming book, but haven't seen anything that can do this, but I seem to remember something along those lines.
Can anyone help?
James
Hi James, the easiest way is something like the following: #include <boost/type_traits.hpp> #include <boost/static_assert.hpp> BOOST_STATIC_ASSERT (boost::is_base_of<Base, Derived>::value); Hope this helps, Martin