|
Boost : |
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-12-31 13:22:36
Jaakko Jarvi wrote:
> I wrote some traits classes for this purpose. They reside in
> boost/lambda/detail/is_instance_of.hpp in lambda_development branch,
> but I think a better place for those classes would be the type_traits
> library - if they're considered to be generally useful.
>
> The usage is as:
>
> is_instance_of_2<std::istream, basic_stream>::value // true
>
> is_instance_of_2<int, basic_stream>::value // false
>
> There are separate templates (is_instance_of_1, is_instance_of_2, ...)
> for different numbers of template parameters of the second argument.
Sounds useful to me.
(Note that the "static From*" data members must be defined outside of
the class. If you want to avoid that (because it's ugly), it's
better to have a "From* something()" inline function.)
John M., Jeremy S., how about adding is_instance_of to the type traits
library?
Jens Maurer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk