Boost logo

Boost :

Subject: Re: [boost] [type_traits] is_base_of<B, D> should work when B is incomplete
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2016-03-03 17:33:25


On Thu, Mar 3, 2016 at 5:18 PM, Daniel Frey <d.frey_at_[hidden]> wrote:

> > 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).
>

Excluding C++98 support, why do you need a compiler intrinsic for this
change? If the reason is the incompleteness check, I've implemented
completeness checking metafunctions before and it's fully possible without
intrinsics in C++11. I described a completeness metafunction that works in
practice a few years ago in a discussion on the mailing list here:
https://groups.google.com/forum/#!topic/boost-developers-archive/zp7u3XHv6zc
which links to an implementation here: http://codepaste.net/xfgcu8 (there
are subtleties to usage, of course). The code that is linked is old and not
fully correct, although in the time since that thread, I have produced what
I believe to be a fully correct and well tested implementation.

-- 
-Matt Calabrese

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