#include <iostream>
#include <functional>
void add(int a, int b, int &r) {
r = a + b;
}
int main() {
int r = 0;
auto f = std::bind(add, std::placeholders::_1, 20, std::reference_wrapper<decltype(r)>(r));
f(10);
std::cout << r << std::endl;
return 0;
}
C++标准库bind用法示例

132

被折叠的 条评论
为什么被折叠?



