【发布时间】:2019-10-31 15:40:34
【问题描述】:
在下面的代码 sn-p 中调用回调函数“无效使用无效表达式”错误 由编译器刷新。
#include <iostream>
#include <functional>
using namespace std;
template<class type>
class State {
public:
State(type type1,const std::function<void (type type1 )> Callback)
{
}
};
template <class type>
void Callback(type type1 )
{
//Based on type validation will be done here
}
int main()
{
State<int> obj(10,Callback(10));
return 0;
}
只是想知道这里出了什么问题,以便解决问题。
【问题讨论】:
-
你能从你的编译器复制并粘贴确切的错误信息吗?
-
错误:无效表达式的使用
标签: c++ callback std-function