I am reading 14.7.2 in C++ Standard draft n3485 and it says:
2 The syntax for explicit instantiation is: explicit-instantiation:
externopt template declarationThere are two forms of explicit instantiation: an explicit instantiation definition and an explicit instantiation declaration. An explicit instantiation declaration begins with the
externkeyword.
Seeing that a template declaration and definition is always put in a header, I have never seen a declaration with extern on a template. What exactly does that bolded sentence mean?
Also why would an instantiation care about extern?
It tells the compiler not to instantiate that template in this TU.
Note that it should be instantiated in one TU (without the extern bit), if you want your code to actually link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With