
Jonathan Turkanis wrote:
"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.
I've attached a somewhat improved version inspired by your attempt. (Thanks!)
Hey! ;-)
It only works on compilers which support has_xxx, but it should handle the case of private inheritance now, by delegating to is_base_and_derived.
Hmmmmm. Looking at your solution, I can see that I was on the right track. What puzzles me is why my attempt fails and yours succeeds. Mine complains that 'bool' has no char_traits member when I try is_ostream<bool> Yours just works. Ahhh. I think I get it. Yours is all wrapped up inside template<typename T> struct is_ostream : mpl::bool_<detail::is_ostream_impl<T>::value> {}; Clever, clever, clever.
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>, ...
Oh, great. I didn't think to look in the aux_ directory and so never spotted has_xxx.hpp. Many, many thanks for all this, Jonathan. Angus