D
DaKoadMunky
My question relates to storing the addresses of functions generated by
templates in pointers to functions.
<CODE>
template<class T>
void Global() {}
namespace ANamespace
{
template<class T>
void InANamespace() {}
}
int main()
{
void (*fncPtr)() = Global<int>; //Compiles on both Comeau & MSVC++.NET
fncPtr = ANamespace::InANamespace<int>; //Compiles on Comeau but not
MSVC++.NET
return 0;
}
</CODE>
Using MSVC++.NET line 1 compiles but line 2 does not.
Using the Comeau Online compiler @ http://www.comeaucomputing.com/tryitout/
both lines compile.
I am assuming that Comeau is correct, but you know what they say about making
assumptions.
Can anyone comment on the correct syntax and which compiler is correct?
Thanks.
templates in pointers to functions.
<CODE>
template<class T>
void Global() {}
namespace ANamespace
{
template<class T>
void InANamespace() {}
}
int main()
{
void (*fncPtr)() = Global<int>; //Compiles on both Comeau & MSVC++.NET
fncPtr = ANamespace::InANamespace<int>; //Compiles on Comeau but not
MSVC++.NET
return 0;
}
</CODE>
Using MSVC++.NET line 1 compiles but line 2 does not.
Using the Comeau Online compiler @ http://www.comeaucomputing.com/tryitout/
both lines compile.
I am assuming that Comeau is correct, but you know what they say about making
assumptions.
Can anyone comment on the correct syntax and which compiler is correct?
Thanks.