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-03 17:18:16

> On 03.03.2016, at 22:57, Andrzej Krzemienski <akrzemi1_at_[hidden]> wrote:
> The Standard ([meta.rel]) requires that in std::is_base_of<B, D> D must be
> a complete type, but it does not require the same of B. This makes sense,
> because if we compare a complete type D and an incomplete type B, the
> former is surely not derived from the latter.
> In contrast, boost::is_base_of imposes an additional constraint that B must
> also be complete. Could this restriction be lifted?

That would probably be possible for all modern compilers that have a proper std::is_base_of because it requires a compiler intrinsic (unless you can implement it without such an intrinsic and in C++98). Boost.TypeTraits have quite a history and by lifting the restriction, you would drop support for old compilers (think pre-C++11).

And if you really need this feature, why not use std::is_base_of directly? Either your compiler has it or it can’t be implemented AFAICT.

Boost list run by bdawes at, gregod at, cpdaniel at, john at