排序
C++11新特性之十:enable_shared_from_this
enable_shared_from_this是一个模板类,定义于头文件<memory>,其原型为: template< class T > class enable_shared_from_this; std::en...
C++11新特性之八:smart pointers
一.智能指针的作用 C++程序设计中使用堆内存是非常频繁的操作,堆内存的申请和释放都由程序员自己管理。程序员自己管理堆内存可以提高了程序的效率,但是整体来说堆内存...
C++11新特性之十三:std::make_unique和std::make_shared
原标题:比起直接使用new,更偏爱使用std::make_unique和std::make_shared 让我们从std::make_unique和std::make_shared之间的比较开始讲起吧。std::make_shared是C++11...
C++11新特性之十一:emplace
emplace操作是C++11新特性,新引入的的三个成员emplace_front、emplace 和 emplace_back,这些操作构造而不是拷贝元素到容器中,这些操作分别对应push_front、insert 和pu...
C++11并发学习之一:小试牛刀
1.与C++11多线程相关的头文件 C++11 新标准中引入了四个头文件来支持多线程编程,他们分别是<atomic> ,<thread>,<mutex>,<condition_variable&...
C++11新特性之十四:std::async
如果你想异步地运行函数doAsyncWork,你有两个基本的选择。你可以创建一个std::thread,用它来运行doAsyncWork,这是基于线程(thread-based)的方法: in...
C++11新特性之十二:std::all_of, std::any_of, std::none_of
一.std::any_of any_of与下列函数等效: template<class InputIterator, class UnaryPredicate> bool any_of (InputIterator first, InputIterator last, UnaryPredicate pred) ...
C++11并发学习之二:线程管理
1.启动线程 (1)使用对象 “小试牛刀”中thread构造时传入的是函数,还可以传入对象。 #include <thread> #include <iostream> void func() { std::cout<<"worker ...
C++11新特性之四:range-based for loops
熟悉C++98/03的对于for循环就再了解不过了,如果我们要遍历一个数组,那么在C++98/03中的实现方式: int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, ...








