|
Boost : |
From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-11-25 07:32:38
>> >I just pasted code from Loki. My entire point was to suggest adding a
>> >similar macro to boost.
>>
>> I think the functionality is a good idea, but I would prefer to see it
>> added as a template, so that the expression:
>>
>> is_public_base<Base, Derived>::value
>>
>> gives the required answer.
>
>Smooth.
Afterwards I realised that there are three possible names here:
is_public_base<base,Derived>,
is_superclass<base,derived>
is_subclass<derived, base>
Of course they all do the same thing, so we only need one of these - it
depends on which way you look at it I guess - personally I prefer
"is_public_base", as it's the easiest to understand what it does (I always
get "superclass" and "subclass" mixed up, and I'm sure I'm not alone!)
>> While we're at it:
>>
>> is_implicit_convertible<T,U>::value
>>
>> would be useful as well (is true only if the conversion is not a UDC).
>The
>> name may not be quite right though....
>
>I disagree. If the programmer adds an implicit conversion, then that
>conversion must be indistiguishable from a built-in conversion for all
>purposes. No?
There are places where they can be distinguished - and we use that in
is_enum to separate real enum's from classes that just look like they're
int's. But whatever, the less we add the less work it is :-)
>By the way, I was /dismayed/ to notice that MWCW 7.0 still fails to
>implement sizeof correctly so as to support is_convertible, although they
>did know of the problem for a year plus (I actually emailed with their
>project lead about that)! What a letdown.
Pitty :-(
- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk