
"David Abrahams" <dave@boost-consulting.com> wrote in message news:un008whj3.fsf@boost-consulting.com...
"Jonathan Turkanis" <technews@kangaroologic.com> writes:
"Angus Leeming" <angus.leeming@btopenworld.com> wrote in message news:ch7h3d$466$1@sea.gmane.org...
I'm trying to ascertain whether a given class is, or is derived from, std::basic_ostream, but I've ground to a halt.
Note that with the current cvs it should not be necessary to write
mpl::and_< mpl::bool_<has_char_type<U>::value>, ...
You can simply say
mpl::and_< has_char_type<U>, ...
It's hard for me to understand why you would need has_xxx for this purpose, or how you would use it.
Well, you could look at the attachment .... ;-) An arbitrary type T is equal to or derived from a specialization of std::basic_ostream iff (almost): (i) it has a member type char_type; (ii) it has a member type traits_type; and (iii) either: (a) it is the same as basic_ostream<T::char_type, T::traits_type>, OR (b) it is derived from basic_ostream<T::char_type, T::traits_type> This asumes that T doesn't have different member types char_type or traits_type which hide those inherited from std::basic_ostream. There's and easier way to do this (featured in the first attachment), but it get's in trouble with private derivation. If you have a simpler or more correct way, please let me know. Jonathan