std::ref用法-CSDN博客

网站介绍:文章浏览阅读6.2k次,点赞12次,收藏33次。1、作用:std::ref 用于取某个变量的引用,引入其是为了解决函数式编程(如std::bind)的一些传参问题。2、用法:#include <functional>#include <iostream>void f(int& n1, int& n2, const int& n3){ std::cout << "In function: " << n1 << ' ' << n2 <&_std::ref