归档
善良比聪明更重要
06
27
std::ref 的作用 std::ref 的作用
C++ 本身有引用 &,为什么 C++11 又引入了 std::ref?主要是考虑函数式编程如 std::bind 在使用时,是对参数直接拷贝,而不是引用。如下例子: void f(int& n1, int& n2,
2019-06-27
13
C++ const 与 mutable C++ const 与 mutable
const:常量,不变的 mutable:易变的。从意思上理解,可见 const 和 mutable 是一对反义词,它们都是 C++的关键字。const 成员函数不能修改调用它的对象。类的成员函数可以被声明为 const,这将使得函数的隐式
2019-06-13