In order to capture metadata about a collection of types that's fixed at compile time, I'd like to store polymorphic descriptors to allow functions to be defined based on the type.
However, this presents a problem, because even if I can instantiate the descriptor objects as constexpr, I'm not sure if there's any way to erase their specific types to store in a constexpr data structure for access at runtime, even if I can guarantee that they're always the same size. Using a union is possible if there's a closed set of types, but doesn't really allow that set to be easily extended. aligned_storage won't work because there's no constexpr placement new.
Is there any way to build type-erased and/or polymorphic collections using constexpr evaluation?
An alternative is to take a more c-like approach and build a function table for descriptors manually, but this seems awkward in C++ where virtual functions exist already