0

Porting code from gcc 2.95.3 to gcc 4.4.2 results in a new compile time error:

too few template-parameter-lists

Below is an abstracted and simplified example of that code. The error occurs on the marked line.

#include <iostream>
using namespace std;

template<class SomeType> class SomeTemplate
{
  public:
    SomeType msg;
    void Func ();
};

void SomeTemplate<long>::Func ()        //--- Error Here ---
{
    cout << "SomeType size: " << sizeof (msg) << endl;
}

int main ()
{
    SomeTemplate<long> MyType;
    MyType.Func ();
}

1 Answers1

2

Write

template <>
void SomeTemplate<long>::Func ()        
{
    cout << "SomeType size: " << sizeof (msg) << endl;
}
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335