Because I had to make a portable code, I decided from a Windows Console application generated with its associated main() within C++ Builder 5 (no vcl, but multithread)... Then, I defined a template class as :
template <class T = char, class U = T> class TPair;
.... other definiions...
template <class T, class U> class TPair { TPair(const T &, const U &);
T A
U B;
};
Eveything is compiling fine... UNDER C++ BUILDER 5...
Going back to Borland C++ 5 (and NOT Builder), I can produce Win32 or Dos16 applications... There the compilation of the above code fails...
It clearly announces that "default parameters are not allowed in class definitions using templates"...
My large code heavily uses the default parameter in the declarations, so I can easily pass a parameter of (2 doubles) or (1 int and 1 double) using a simple declarations like TPair<double>
or TPair<int, double>
... instead of TPair<double, double>
less readable...
Any workaround...?