template <T>
int f(T a) {
return sizeof(a);
}
int main() {
f<float>(4.0);
return 0;
}
The template's point of instantiation is just before "int main".
A template declaration must be in scope at a template's point of instantiation.
Reference: http://publib.boulder.ibm.com/infocenter/compbgpl/v9v111/index.jsp?topic=/com.ibm.xlcpp9.bg.doc/language_ref/name_binding.htm

No comments:
Post a Comment