2016-03-03 23:33 GMT+01:00 Matt Calabrese
On Thu, Mar 3, 2016 at 5:18 PM, Daniel Frey
wrote: On 03.03.2016, at 22:57, Andrzej Krzemienski
wrote: The Standard ([meta.rel]) requires that in std::is_base_of 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.
This is quite interesting. However, for my particular purpose, I may not need to employ a C++11 solution. I have an incomplete type boost::in_place_factory. I want to check if a given type T is either derived from boost::in_place_factory. It doesn't have to be very strict: it can get false negative on multiple inheritance; it can give a false positive when T is implicitly convertible to boost::in_place_factory by other means, or simply return false_type when boost::in_place_factory is incomplete. Perhaps there is a C++03-compatible solution to this particular problem? Regards, &rzej