On Tue, Jan 31, 2023 at 3:23 PM Billy Martin via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
You can't do this because there isn't any code that knows both B and D at compile time.

The case I'm thinking of involves some templated container that has an object of type D. (Maybe it's a type erasure system, a smart pointer, whatever). That container knows the type D because it was passed as a template argument when it was instantiated with a brand new D object. Somewhere else, some other code has a pointer B* and they want it to point to this object, but they don't know what type D is (it might not even be knowable until runtime).

Can you please show some example code?  Just write the exact code you think you want to write, but pretend that `std::bases_of<T>::type` already exists. Show how you'll solve your problem using `std::bases_of<T>::type`.

Thanks,
Arthur