Explicit template declaration/definition in VS 2012
问题 The following code declares a template, declares an explicit instantiation definition, then declares an explicit instantiation declaration: template <typename T> T Double(T number) { return number * 2; } extern template int Double<int>(int); // declaration template int Double<int>(int t); // definition int main(int argc, char* argv[]) { int n = Double(10); return 0; } gives an error: error C2929: 'int Double<int>(int)' : explicit instantiation; cannot explicitly force and suppress