I'd like to prevent all implicit template instantiations for a specific templated class in order to prevent it from being instantiated into every translation unit.
It looks like my options are:
- Use -fno-implicit-templates on gcc's command line. This suppresses all implicit template instantiations, and is not what I want. I only want to prevent it for a single template.
- Use C++11 "extern template". But this only suppresses specific explicit instantiations. I don't want to type out an "extern template" line for every potential template parameter list this template might be instantiated with.
So I need something in-between. It would be nice to have something like:
extern template class Foo; // suppress all implicit instantiations of Foo
Any ideas?
Aucun commentaire:
Enregistrer un commentaire