|
Boost : |
From: Philip Dunstan (phil_at_[hidden])
Date: 2003-04-29 18:33:59
Hi there,
Should this work?
I've tried it using g++ 3.2 (redhat and cygwin) and borland c++ builder
5.6.4 and it fails on the assert for all of them.
#include <boost/type_traits.hpp>
#include <cassert>
class A {};
class B : public A {};
template <typename T>
bool isDerivedFromA(const T& t)
{
return boost::is_base_and_derived<A, T>::value;
}
int main()
{
B b;
A* pa = &b;
assert(isDerivedFromA(*pa));
return 0;
}
thanks,
Phil
-- Philip Dunstan phil_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk