Microsoft has an extension whereby one can declare that a template instantiation will be external; consequentially, it does not get implicitly instantiated. At least that's the theory. I tried reproducing that with the code
#include <vector>
class Foo{
int i;
public:
virtual ~Foo();
};
extern template class std::vector<Foo>;
This gives me
warning C4231: nonstandard extension used : 'extern' before template
explicit instantiation
However, nothing else seems to happen: the program continues to link find, even though I use push_back (and dumpbin shows that push_back was instantiated).
Only when I declare
extern template void std::vector<Foo>::push_back(const Foo&);
I get an linker error as expected.
So: how can I declare the entire instantiation (all members) as explicit, preventing implicit instantiation?