Calling overloaded function using templates (unresolved overloaded function type compiler error) [duplicate]

不羁岁月 提交于 2019-12-06 03:46:22

This fails to compile because ShareUtils::getRank does not refer to a single function but to a family of functions (there are several signatures for this name).

You want to cast to function pointer to suppress the ambiguity, which means that you must know from the rank function which getRank should be called (which should not be a problem in your case) :

virtual unsigned rank() const
{ return getValue(*this, rank_, (unsigned (ShareUtils::*)(const Share&)) &ShareUtils::getRank); } 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!