Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-11-17 22:59:45


> > > Does anybody know how to implement type traits that will allow me to
> check
> > > whether argument type T is instance od template A. Particularly I am
> > > interested in mpl sequences. I.e.:
> > >
> > > is_instance_of<T,mpl::list>::value
> >
> > Check out boost/lambda/detail/is_instance_of.hpp

>
> 1. Could we make it an "official" type trait?

Sure. John, do you agree?

> 2. Could we make if work with no template template support?
> I was thinking about:
> is_instance_of<T,mpl::list<_> >::value
> But I do not understand how mpl::lambda is working yet, so it could be
> complete nonsense.

I'm not aware of a solution without template template parameters.

> 3. Why there is no namely is_instance_of version without number of template
> parameters explicitly specified.
> Could not you deduce it automatically?

The second argument is a template template parameter, and I think that
type must be spelled out entirely, thus I can't see a way to get rid of
the n in is_instance_of_n. I hope someone can prove me wrong.

> 4. Why it is limited only to 4 template parameters?
Well, 4 met the needs of LL, and it never got extended as it wasn't
made to an 'official' type trait.

Note that there are other limitations, templates with non-type parameters
are not supported.

Jaakko


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