Boost logo

Boost :

Subject: Re: [boost] [type_traits] is_base_of<B, D> should work when B is incomplete
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-03-03 23:10:03


On 4/03/2016 12:24, Daniel Frey wrote:
> 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 think the operative question is, why would you use it?

If you know you have C++11 compilers always, then use std::is_base_of
and your code can use complete or incomplete types as you wish.

If you don't know you have C++11 compilers always, then use
boost::is_base_of and restrict yourself to complete types.

If you're using the Boost version to broaden compiler support, then your
code would not compile (or would produce different results) depending
which environment you compiled it in. So you could end up with code
that works in development but fails in production.


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