我尝试 boost::phoenix::function
使用带参数的 lambda 函数进行调用,但失败了。如果我以这种方式不带参数调用它:
const auto closure = [](){
cout<< "test" << endl;
};
typedef decltype(closure) ClosureType;
const boost::phoenix::function<ClosureType> lazyFunc (std::move(closure));
lazyFunc()();
一切都很好。但是当我声明至少一个 lambda 参数时:
const auto closure = [](int& param) { cout<<"Test" << param << endl; };
typedef decltype(closure) ClosureType;
const boost::phoenix::function<ClosureType> lazyFunc (std::move(closure));
lazyFunc(arg1)(a);
编译失败, boost::result_of内部有大量堆栈跟踪