【发布时间】:2016-09-17 18:43:47
【问题描述】:
给出的是以下类(只是标题):
class Example {
public:
template<class C>
Example(bool(C::*callbackFunc)(Foo&) = nullptr) : callbackFunc(callbackFunc);
template<class C>
??? getCallbackFunc() const {
return callbackFunc;
}
private:
// store the func ptr
template<class C>
bool (C::*callbackFunc)(Foo&);
};
getter getCallbackFunc() 的正确返回类型是什么?
【问题讨论】:
-
Example::callbackFunc是函数声明,而不是变量。查找最令人头疼的解析。 -
真的可以存会员模板吗?
标签: c++ function templates callback function-pointers