S
samjam86
If default values are to be considered, the below code should compile.
But it is not compiling on g++ 4.4.3.
#include <iostream>
using namespace std;
template<typename FunctionType>
void callback_helper(FunctionType function)
{
function();
}
void print_arg_0()
{
cout << "Inside print_arg_0" << endl;
}
void print_arg_1_opt(int a = 10)
{
cout << "Inside print_arg_1_opt" << endl;
}
int main()
{
callback_helper(print_arg_0);
callback_helper(print_arg_1_opt);
return 0;
}
But it is not compiling on g++ 4.4.3.
#include <iostream>
using namespace std;
template<typename FunctionType>
void callback_helper(FunctionType function)
{
function();
}
void print_arg_0()
{
cout << "Inside print_arg_0" << endl;
}
void print_arg_1_opt(int a = 10)
{
cout << "Inside print_arg_1_opt" << endl;
}
int main()
{
callback_helper(print_arg_0);
callback_helper(print_arg_1_opt);
return 0;
}