lambda 表达式的方式:
[this](const std::shared_ptr<Imu>& imu_ptr){
this->ReceiveImuCallback(imu_ptr);
}
boost::bind的方式
boost::bind(&回调函数, this, _1);
举个🌰
#include <iostream>
#include <boost/bind.hpp>
void printSum(int a, int b) {
std::cout << "Sum: " << a + b << std::endl;
}
int main() {
auto sumFunction = boost::bind(&printSum, 10, _1);
sumFunction(20);
return 0;
}