Ciaran McCreesh’s Blag
Now with 17% more caffeine
C++ Explicit Template Instantiation Hate Redux
Today’s hatred of C++ is brought to you by the section [temp.explicit]:
A definition of a class template or class member template shall be in scope at the point of the explicit instantiation of the class template or class member template.
Unfortunately, it doesn’t “explicit instantiation definition” there, so you can’t do an explicit instantiation declaration when you only have a class declaration available. I can’t figure out what changing this would break, and whether it’s just an omission (explicit instantiation declarations are new in C++0x, but explicit instantiations are not) or a deliberate restriction.
Whilst we’re on the subject, not being able to use typedef names when explicitly instantiating is still a pain in the arse too, although the implications of allowing that are almost certainly moderately icky.