NDDEM
|
Classes | |
struct | polymorphic_binding_tag |
Tag for init_binding, bind_to_archives and instantiate_polymorphic_binding. For C++14 and below, we must instantiate a unique StaticObject per TU that is otherwise identical – otherwise we get multiple definition problems (ODR violations). To achieve this, put a tag in an anonymous namespace and use it as a template argument.
For C++17, we can use static inline global variables to unify these definitions across all TUs in the same shared object (DLL). The tag is therefore not necessary. For convenience, keep it to not complicate other code, but don't put it in an anonymous namespace. Now the template instantiations will correspond to the same type, and since they are marked inline with C++17, they will be merged across all TUs.