Detect derivation from e.g. addable
Is there a way to detect that a class has been derived from
boost::addable<T>, for example? I would like to be able to
write something like this:
template <typename T>
void foo() {
//if T derived from boost::addable
On Thursday 28 March 2002 04:44 pm, you wrote:
Is there a way to detect that a class has been derived from boost::addable<T>, for example? I would like to be able to write something like this:
template <typename T> void foo() { //if T derived from boost::addable
// . . . } The problem, of course, is the base class chaining feature. I do not see how to use boost::is_base_and_derived in this case.
If you still need to solve this problem after two weeks, the solution is to
use the 'sizeof' trick that is used by the boost::is_base_and_derived class:
typedef char yes_type;
typedef double no_type;
template
participants (2)
-
Douglas Gregor
-
whastingsnj