The compiler compiled this code successfully, but when I try to move the definition of the constructor and the method outside the class, the compiler cannot compile it.
With this code, The compiler generated these errors:
1 2 3 4 5 6 7 8 9 10 11 12
... error C2244: 'mycontainer<char>::{ctor}' : unable to match function definition to an existing declaration
definition
'mycontainer<char>::mycontainer(char)'
existing declarations
'mycontainer<char>::mycontainer(const mycontainer<char> &)''mycontainer<char>::mycontainer(char)'
... error C2244: 'mycontainer<char>::uppercase' : unable to match function definition to an existing declaration
TemplateSpecialization3.cpp(36) : see declaration of mycontainer<char>::uppercase'
definition
'char mycontainer<char>::uppercase(void)'
existing declarations
'char mycontainer<char>::uppercase(void)'
I use the compiler "Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86", and compile the source-code with "cl /clr *.cpp" command.
Did anyone encounter this problem? Why? Is my second code incorrect or the compiler doesn't allow?