www.digitalmars.com         C & C++   DMDScript  

c++ - Default parameter in template function

reply Dimitri Kaparis <dkaparis universalstudyhelper.com> writes:
Greetings,

It seems that invoking a template function with a default parameter more than
once in a unit causes "redefinition of default parameter" error.
The following code triggers the problem:

template <class T>
void myFunc(int=1);

void main()
{
myFunc<int>();
myFunc<int>();
}

Dimitri Kaparis,
Independent Developer
http://www.universalstudyhelper.com - software to help you study any subject.
May 15 2002
parent "Walter" <walter digitalmars.com> writes:
Thanks for reporting this. -Walter

"Dimitri Kaparis" <dkaparis universalstudyhelper.com> wrote in message
news:abu60i$864$1 digitaldaemon.com...
 Greetings,

 It seems that invoking a template function with a default parameter more
than
 once in a unit causes "redefinition of default parameter" error.
 The following code triggers the problem:

 template <class T>
 void myFunc(int=1);

 void main()
 {
 myFunc<int>();
 myFunc<int>();
 }

 Dimitri Kaparis,
 Independent Developer
 http://www.universalstudyhelper.com - software to help you study any
subject.
May 15 2002