pointer to const member function typedef
Posted
by oldcig
on Stack Overflow
See other posts from Stack Overflow
or by oldcig
Published on 2010-06-16T04:54:47Z
Indexed on
2010/06/16
5:02 UTC
Read the original article
Hit count: 230
I know it's possible to separate to create a pointer to member function like this
struct K { void func() {} };
typedef void FuncType();
typedef FuncType K::* MemFuncType;
MemFuncType pF = &K::func;
Is there similar way to construct a pointer to a const function? I've tried adding const in various places with no success. I've played around with gcc some and if you do template deduction on something like
template <typename Sig, typename Klass>
void deduce(Sig Klass::*);
It will show Sig with as a function signature with const just tacked on the end. If to do this in code it will complain that you can't have qualifiers on a function type. Seems like it should be possible somehow because the deduction works.
© Stack Overflow or respective owner