Boost logo

Boost :

Subject: Re: [boost] [type_traits] is_base_of<B, D> should work when B is incomplete
From: John Maddock (jz.maddock_at_[hidden])
Date: 2016-03-04 04:24:42


>> 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?
>>
> Actually, I do not even need a true-false answer; I just need to disable an
> overload (in SFINAE sense) if boost::in_place_factory is either incomplete
> or not a base class of T.

This may be fixable (or alternatively the fix may just break a ton of
things.... we'll see), but I'm curious why in_place_factory needs to be
incomplete - surely if you handle that base class a special case then
you need it's definition anyway? In any case why not just include the
header and be done with?

Thanks, John.


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