Adrin Jalali <adrin.jalali(a)gmail.com> wrote:
when you want to send realf pointer ro the ff function, you must
specify
that the input function of ff has two arguments, and when you want to call
that function from ff, again you must specify both input, I see nothing
strange here, fixed code is attached.
You can call realf with one or two arguments, that is the whole point of
the default argument. Look at the following, where realf gives an error,
realg (which should behave the same!) doesn't.
--=-=-=
Content-Type: text/x-c++
Content-Disposition: attachment; filename=tst.cc
Content-Description: New testcase
template <typename T>
static void ff(int i, T f)
{
f(i);
}
void realf(int i, int j = 1000)
{
}
void realg(int i)
{
}
void realg(int i, int j)
{
}
void callf()
{
ff(117, realf);
}
void callg()
{
ff(118, realg);
}
--=-=-=
--
Dr. Horst H. von Brand User #22616
counter.li.org
Departamento de Informatica Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria +56 32 2654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 2797513