Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-27 11:17:59


Joel de Guzman wrote:
> Brian McNamara <lorgon_at_[hidden]> 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 this a real or imagined problem? Perhaps it's just me, but, when
> I first got to use is_base_and_derived, without thinking, I got the
> arguments reversed a couple of times, and, I had to actually re-read
> the doc to know the proper ordering of arguments. It's not even
> clear when you huriedly read the docs:
>
> ::boost::is_base_and_derived<T,U>::value
>
> Then you'll have to read:
>
> Evaluates to true if type T is a base class to type U.
>
> Uhh, ok...
>
> It would have been better if it was doc'd as:
>
> ::boost::is_base_and_derived<B,D>::value
>
> Nevertheless...

I've repeatedly suggested is_base_of<B, D> ("B is a base of D") and
is_derived_from<D, B> ("D is derived from B") and repeatedly been ignored.
;-)


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