System::Action typedef

Action typedef

引用无返回值方法的委托类型。

using System::Action =  MulticastDelegate<void(Args...)>

备注

#include <system/action.h>

using namespace System;

// 打印传入字符串的函数。
void PrintString(const String &string)
{
  using namespace std;
  cout << string << endl;
}

int main()
{
  // 创建 Action 的实例。
  auto action = Action<String>(std::bind(&PrintString, std::placeholders::_1));

  // 调用该操作。
  action(u"Hello, world!");

  return 0;
}
/*
This code example produces the following output:
Hello, world!
*/

另见