T
Tim Frink
Hi,
how can I set default values to template parameters?
I've this code:
class A
{
template<typename T>
void foo( string = "", T* = 0, bool (T::*func)(void) = 0 );
};
when I invoke A::foo with the appropriate 3 parameters, everything
works fine. However, I'd like to invoke the function foo also
with the first parameter, like objectA.foo( string("test") );
When I try to compile, I get the error message:
"no matching function for A::foo(std::string)".
Why? I set the second and third parameter of foo to default values,
so when the second and third argument are not specified, they should
be set to 0. But this seems not to work that way.
Tim
how can I set default values to template parameters?
I've this code:
class A
{
template<typename T>
void foo( string = "", T* = 0, bool (T::*func)(void) = 0 );
};
when I invoke A::foo with the appropriate 3 parameters, everything
works fine. However, I'd like to invoke the function foo also
with the first parameter, like objectA.foo( string("test") );
When I try to compile, I get the error message:
"no matching function for A::foo(std::string)".
Why? I set the second and third parameter of foo to default values,
so when the second and third argument are not specified, they should
be set to 0. But this seems not to work that way.
Tim