这被定义为一个类的公共成员。
array:3 [▼
0 => array:5 [▼
"asset_id" => 2
"weekam" => 150.0
"weekpm" => 300.0
"nonweekam" => 160.0
"nonweekpm" => 400.0
]
1 => array:5 [▼
"asset_id" => 1
"weekam" => 110.0
"weekpm" => 180.0
"nonweekam" => 210.0
"nonweekpm" => 410.0
]
2 => array:5 [▼
"asset_id" => 4
"weekam" => 120.0
"weekpm" => 320.0
"nonweekam" => 220.0
"nonweekpm" => 420.0
]
]
想要传递这样的信号: -
boost::signals2::signal<void (int, std::string, std::string, int)> sigApp;
使用它: -
Application* newApp = new Application(pSn, &mdCache_, &sigApp);
程序在运行时退出。 我应该如何将升压信号传递给函数?
由于
答案 0 :(得分:0)
您不应该传递signal
,当信号引发时,您需要“连接”一些回调来调用。例如:
boost::signals2::signal< void(int, std::string, std::string, int) > sigApp;
sigApp.connect([](int a, std::string b, std::string c, int d)
{
// do something
});
sigApp.connect([](int a, std::string b, std::string c, int d)
{
// do another thing
});
// raise the event
sigApp(1, "b", "c", 2);
你们已经准备好了。