Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-01-29 09:50:10


On Wednesday 29 January 2003 09:42 am, Daniel Frey wrote:
> // given some is_base_and_derived< B, D >::value
>
> template< typename T > struct is
> {
> template< typename U > struct derived_from
> { enum { value = is_base_and_derived< U, T >::value };
> template< typename U > struct base_of
> { enum { value = is_base_and_derived< T, U >::value };
> };
>
> // usage:
>
> is< D >::derived_from< B >::value
> is< B >::base_of< D >::value
>
> Thoughts?
>
> Regards, Daniel

It gets ugly in the common case (where D is a template parameter):
  is<D>::template derived_from<B>::value

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk