大佬教程收集整理的这篇文章主要介绍了C这行代码是什么意思?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
using Fun = std::function<void()>; using PFun = std::function<void(Fun)>;
它是类(SELEctor)的私有成员.
周边代码:
namespace sel { class State; class SELEctor { private: friend class State; State &_state; using Fun = std::function<void()>; using PFun = std::function<void(Fun)>; // Traverses the structure up to this element Fun _traverse; // Pushes this element to the stack Fun _get; // Sets this element from a function that pushes a value to the // stack. PFun _put; // Functor is stored when the () operator is invoked. The argument // is used to inDicate how many return values are expected using Functor = std::function<void(int)>; mutable std::unique_ptr<Functor> _functor; SELEctor(State &s,Fun traverse,Fun get,PFun put) : _state(s),_traverse(traversE),_get(get),_put(put),_functor{nullptr} {} SELEctor(State &s,const char *Name);
using Fun = std::function<void()>; // same as typedef std::function<void()> Fun
这意味着你可以这样做:
void foo() { std::cout << "foo\n"; } Fun f = foo; // instead of std::function<void()> f = foo; f();
同样对于PFun.
以上是大佬教程为你收集整理的C这行代码是什么意思?全部内容,希望文章能够帮你解决C这行代码是什么意思?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。