Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2004-09-03 06:17:12


"Jonathan Turkanis" <technews_at_[hidden]> writes:

> "David Abrahams" <dave_at_[hidden]> wrote in message
> news:un008whj3.fsf_at_boost-consulting.com...
>> "Jonathan Turkanis" <technews_at_[hidden]> writes:
>>
>> > "Angus Leeming" <angus.leeming_at_[hidden]> wrote in message
>> > news:ch7h3d$466$1_at_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 .... ;-)

I did, but got mired in details.

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

Why not just copy the implementation of is_base_and_derived and
templatize the conversion operators in the Host class?

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net