D
Dilip
I am stuck with a syntactical issue and would appreciate some help:
I have a class with a templated mem fn like so:
class A
{
};
template<typename Ret, typename P1, Ret (A::*fp)(P1*)>
void A::somefunc()
{
P1* p = getP1FromSomewhere();
someotherfunc(p, fp);
}
// should I re-write the whole template shebang for someotherfunc?
// I tried (probably w/o understanding completely)
template<typename X, typename T>
void A::someotherfunc(X* p1, T func)
{
// fails with compiler error the statement does not evaluate to a
function being called
// with one parameter
func(p1);
}
What is the correct way to pass function pointers in a cascade?
P.s: I am mucking around with legacy code and although there might be
better ways of acheiving what I want, I am not in a position to make
whole-sale code changes
I have a class with a templated mem fn like so:
class A
{
};
template<typename Ret, typename P1, Ret (A::*fp)(P1*)>
void A::somefunc()
{
P1* p = getP1FromSomewhere();
someotherfunc(p, fp);
}
// should I re-write the whole template shebang for someotherfunc?
// I tried (probably w/o understanding completely)
template<typename X, typename T>
void A::someotherfunc(X* p1, T func)
{
// fails with compiler error the statement does not evaluate to a
function being called
// with one parameter
func(p1);
}
What is the correct way to pass function pointers in a cascade?
P.s: I am mucking around with legacy code and although there might be
better ways of acheiving what I want, I am not in a position to make
whole-sale code changes