Topic: Default arguments in template class
Author: saito-naoki@math.yale.edu (Naoki Saito)
Date: 4 Feb 1994 13:36:40 -0500 Raw View
Hello. I wrote a template class which has a member function having a
default values in its arguments:
template<class DT>
class foo
{
int size;
DT* buf;
public:
DT func(int,int=0);
...
};
Then I got the following compilation error:
"./foo.h", line 50: error: function templates do not support default arguments
"./foo.h", line 50: sorry, cannot recover from earlier errors
In C++ 3.0, this is prohibited? If so, why? What's wrong with default
arguments in template classes? Is there any difficulty for the C++ translator
designer if this is allowed? (N.B. We are using Sun C++3.0.)
Best regards and thanks in advance,
===============================================================================
Naoki Saito | Address: Schlumberger-Doll Research
| Old Quarry Road
Schlumberger-Doll Research | Ridgefield, CT 06877 USA
and | Email: saito@ridgefield.sdr.slb.com
Dept. of Mathematics | Phone: (203) 431-5209
Yale University | Fax: (203) 438-3819
===============================================================================