Boost logo

Boost :

Subject: Re: [boost] [type_traits] is_base_of<B, D> should work when B is incomplete
From: Daniel Frey (d.frey_at_[hidden])
Date: 2016-03-04 01:30:00


> On 04.03.2016, at 05:22, Michael Caisse <mcaisse-lists_at_[hidden]> wrote:
>
> On 3/3/16 15:24, Daniel Frey wrote:
>>> On 03.03.2016, at 23:33, Matt Calabrese <rivorus_at_[hidden]> wrote:
>>>
> <snip>
>> That is a very interesting technique, I didn’t knew about it. But if std::is_base_of is available, boost::is_base_of should surely just forward to it, so only those compilers that don’t have it (aka mostly pre-C++11 compilers) are of interest here. Maybe lifting the restriction (and using an alternative implementation) should be conditional, only to be guaranteed by boost::is_base_of when compiling with C++11 or newer?
>>
> I am really *not* a fan of this. It breaks things that shouldn't be broken by changing the implementation based on the compiler. This sometimes results in different and surprising behaviour. If I'm asking for the Boost version, I actually want the Boost version and not the compiler's std library version.

I’m also not a fan of changing it. Use std::is_base_of if possible and boost::is_base_of when not.

Regardless, my suggestion would not break anything. It will only provide an additional feature starting with a compiler that implements (and is configured to use) C++11 (or newer). And the old version would result in a compile-time error when using this feature, so it won’t silently change the behavior of existing code. But again, I don’t really see a need for the change either.

Daniel




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