Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-01-29 09:42:43


John Maddock wrote:
>
> > I've always felt that is_base_and_derived is a funny name. is_base_of<B,
> D>
> > and is_derived_from<D, B> both look pronounceable(sp?) to me: "is B a base
> > of D? is D derived from B?"
> >
> > While we're at it, is the final verdict that is_base_and_derived<void, X>
> > should be false? What about is_base_and_derived<void, void>?
>
> The LWG suggested (and I agreed with) a change to "is_base".

I don't like this - I gave the rationale in another posting already.
Here's yet another idea which might keep the syntax readable for the
user:

// 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

-- 
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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