I get two errors when I compile the code from the webpage. First, it should be
Code:
container (char arg) {element=arg;}
in the specialization of the class instead of T, since T would be undeclared at that point.
The second error is fixed when I remove the template<> from the implementation of uppercase. My compiler is VC++ 7.1. I'm not sure if the issues are due to our compilers or the cplusplus tutorial code.
BTW, Comeau online gives the following errors (and compiles it cleanly with the changes I mentioned above):
Code:
Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++
"ComeauTest.c", line 17: error: identifier "T" is undefined
container (T arg) {element=arg;}
^
"ComeauTest.c", line 22: error: "char container<char>::uppercase()" is not an
entity that can be explicitly specialized
char container<char>::uppercase()
^
2 errors detected in the compilation of "ComeauTest.c".