Possible duplicate:
How to get the address of an overloaded member function?
I have a function overloaded for a set of types in an inheritance inheritance hierarchy, for example. Share with FutureShare and OptionShare.
virtual unsigned rank() const { return getValue(*this, rank_, &ShareUtils::getRank); } template<typename TShare , typename TMember, typename TGetMemberFunc > TValue& getValue(const TShare& share, boost::optional<TMember>& member, TGetMemberFunc func) { if(!member) { member.reset(func(share)); } return *member; } boost::optional<unsigned> rank_;
When compiling, I get the following error:
Share.h: In member function `virtual unsigned int Share::rank() const': Share.h:25: error: no matching function for call to `Share::getValue(const Share&, boost::optional<unsigned int>&, <unresolved overloaded function type>) const'
How to properly call an overloaded function? I realized that TShare will allow overload when calling func?
EDIT I forgot to mention the overloaded static functions.
c ++ templates function-overloading
Graeme
source share