C ++ nested templates
Possible duplicate:
Strange VC ++ compilation error, C2244
I have the following C ++ code with a template structure and its member function. The template function uses a template parameter in its declaration. The code won't compile.
template<typename MyType>
struct Network
{
template<typename MyOtherType>
void Do_Stuff(char param[MyOtherType::size]);
};
template<typename MyType>
template<typename MyOtherType>
void Network<MyType>::Do_Stuff(char param[MyOtherType::size])
{
};
struct Array_Size
{
static const int size;
};
const int Array_Size::size=3;
int main()
{
}
Visual Studio 2010 generates the following error:
error C2244: 'Network<MyType>::Do_Stuff' : unable to match function definition to an existing declaration
definition
'void Network<MyType>::Do_Stuff(char [MyOtherType::size])'
existing declarations
'void Network<MyType>::Do_Stuff(char [MyOtherType::size])'
I don't understand why the compiler doesn't find a match even though the definition and declaration are identical.
+3
source to share
No one has answered this question yet
See similar questions:
or similar: