M
mathieu
Could someone please tell me what is wrong with the following -ugly-
piece of c++ code. Why when I explicititely set the template parameter
my gcc compiler start getting confused:
bla.cxx: In function 'int main()':
bla.cxx:25: error: call of overloaded 'foo(short unsigned int*&)' is
ambiguous
bla.cxx:2: note: candidates are: void foo(OutputType*) [with PixelType
= short unsigned int, OutputType = short unsigned int]
bla.cxx:10: note: void foo(PixelType*) [with PixelType
= short unsigned int]
with code:
template <class PixelType,class OutputType>
void foo(OutputType *outputCurve)
{
PixelType pt;
}
template <class PixelType>
void foo(PixelType *outputCurve)
{
foo<PixelType,PixelType>(outputCurve);
}
int main()
{
unsigned short *o = 0;
// foo(o); // ok
foo<unsigned short>(o); // not ok
return 0;
}
Thanks !
piece of c++ code. Why when I explicititely set the template parameter
my gcc compiler start getting confused:
bla.cxx: In function 'int main()':
bla.cxx:25: error: call of overloaded 'foo(short unsigned int*&)' is
ambiguous
bla.cxx:2: note: candidates are: void foo(OutputType*) [with PixelType
= short unsigned int, OutputType = short unsigned int]
bla.cxx:10: note: void foo(PixelType*) [with PixelType
= short unsigned int]
with code:
template <class PixelType,class OutputType>
void foo(OutputType *outputCurve)
{
PixelType pt;
}
template <class PixelType>
void foo(PixelType *outputCurve)
{
foo<PixelType,PixelType>(outputCurve);
}
int main()
{
unsigned short *o = 0;
// foo(o); // ok
foo<unsigned short>(o); // not ok
return 0;
}
Thanks !