www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Default parameter in template function

↑ ↓ ← 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
↑ ↓ → "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

 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

May 15 2002