D
Dave
Hello all,
At the line marked "Problem here???" below, I get successful compilation on
one platform and failure on another. What does the Standard say about this?
Is this a correct program? May a member function be called through a
pointer when some parameter default values are accepted (i.e. not all
parameters are passed)?
Thanks,
Dave
#include <iostream>
using namespace std;
class foo
{
public:
int do_it(int = 10) {return 42;}
};
template <typename RET, typename OBJECT_TYPE, typename PTR_TO_MEM_FUN>
RET call_it(OBJECT_TYPE &ds, PTR_TO_MEM_FUN pm)
{
return (ds.*pm)(); // Problem here???
}
int main()
{
foo bar;
cout << call_it<int>(bar, &foo::do_it) << endl;
}
At the line marked "Problem here???" below, I get successful compilation on
one platform and failure on another. What does the Standard say about this?
Is this a correct program? May a member function be called through a
pointer when some parameter default values are accepted (i.e. not all
parameters are passed)?
Thanks,
Dave
#include <iostream>
using namespace std;
class foo
{
public:
int do_it(int = 10) {return 42;}
};
template <typename RET, typename OBJECT_TYPE, typename PTR_TO_MEM_FUN>
RET call_it(OBJECT_TYPE &ds, PTR_TO_MEM_FUN pm)
{
return (ds.*pm)(); // Problem here???
}
int main()
{
foo bar;
cout << call_it<int>(bar, &foo::do_it) << endl;
}