S
SoilMan
Consider the following:
class xyz
{
public:
template <typename T>
void foo(T x)
{
cout << "foo<T> " << x << endl;
}
template <> // remove this line or not?
void foo(int x)
{
cout << "foo<int> " << x << endl;
}
};
This code compiles on MS VS C++ 2003 and Intel C++ 9 but not on Dev-C++
4.9.9.2. However, if I comment out the line "template<>", it compiles
fine on all 3 compilers.
Can someone please explain what is the standard C++ on this matter?
Thank you.
Chris
class xyz
{
public:
template <typename T>
void foo(T x)
{
cout << "foo<T> " << x << endl;
}
template <> // remove this line or not?
void foo(int x)
{
cout << "foo<int> " << x << endl;
}
};
This code compiles on MS VS C++ 2003 and Intel C++ 9 but not on Dev-C++
4.9.9.2. However, if I comment out the line "template<>", it compiles
fine on all 3 compilers.
Can someone please explain what is the standard C++ on this matter?
Thank you.
Chris