Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-10-27 14:08:45


Rene Rivera <grafik.list_at_[hidden]> writes:

> [2003-10-27] Brian McNamara wrote:
>
>>On Mon, Oct 27, 2003 at 07:33:16AM -0700, Dave Gomboc wrote:
>>> > Actually I'd prefer
>>> >
>>> > is_proper_subtype< D, B >
>>> > is_subtype< D, B >
>>> >
>>> > but you have to be careful that you reverse the argument
>>> > order when changing your old code over from is_base_and_derived.
>>>
>>> Many different forms specifying one but not the other (ancestor,
>>> descendent, superclass, subclass, etc.) were rejected due to the ease
>>> with which a developer could nonetheless misinterpret which argument is
>>> supposed to go first. (You could trawl the archives for this.)
>>
>>I can definitely imagine this. I was thinking the same thing and was
>>going to cite the 'argument order clarity' as one of the advantages to
>>is_base_and_derived, until I had the epiphany that
>>
>> is_subtype< D, B >
>>
>>is just how C++ forces us to spell
>>
>> D::is_subtype<B>
>>
>>non-intrusively.
>>
>>
>>Oh, which means I actually prefer the name "is_subtype_of".
>>
>>
>>It's totally analogous to the non-meta case, e.g.
>>
>> contains( aRegion, aPoint )
>>
>>means
>>
>> aRegion.contains( aPoint )
>
> Doesn't that then argue for something like:
>
> is_<D>::subtype_of<B>
>
> ??

only if you don't mind:

     typename is_<D>::template subtype_of<B>::type
                      ^^^^^^^^

Yikes. How about

    infix<D,is_subtype_of,B>::type

??

I kinda like that one. Probably better names than "infix" are possible.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk