C++11

C++11新特性之十:enable_shared_from_this-卡核

C++11新特性之十:enable_shared_from_this

       enable_shared_from_this是一个模板类,定义于头文件<memory>,其原型为: template< class T > class enable_shared_from_this;        std::en...
草上爬的头像-卡核草上爬
6039431
C++11新特性之一:auto-卡核

C++11新特性之一:auto

C++是一门伟大的语言,永远给程序员最大的设计自由, 未使用的特性从不产生副作用,新版本永远完全兼容旧版本。 C++11先前被称作C++0x,...
草上爬的头像-卡核草上爬
913115
C++11新特性之八:smart pointers-卡核

C++11新特性之八:smart pointers

一.智能指针的作用 C++程序设计中使用堆内存是非常频繁的操作,堆内存的申请和释放都由程序员自己管理。程序员自己管理堆内存可以提高了程序的效率,但是整体来说堆内存...
草上爬的头像-卡核草上爬
5999473
C++11的重大改变-卡核

C++11的重大改变

自从C++语言第一次迭代已经过去13年。C++标准委员会成员Danny Kalev在本文中解释了这门编程语言有怎样的改进,以及如何帮助你编写更好的代码。 C++的发明...
草上爬的头像-卡核草上爬
3320948
C++11并发学习之六:线程池的实现-卡核

C++11并发学习之六:线程池的实现

为什么要使用线程池?        目前的大多数网络服务器,包括Web服务器、Email服务器以及数据库服务器等都具有一个共同点,就是单位时间内必须处理数目巨大的连接请求...
草上爬的头像-卡核草上爬
454811
C++11新特性之十三:std::make_unique和std::make_shared-卡核

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...
草上爬的头像-卡核草上爬
3755449
C++11新特性之十一:emplace-卡核

C++11新特性之十一:emplace

emplace操作是C++11新特性,新引入的的三个成员emplace_front、emplace 和 emplace_back,这些操作构造而不是拷贝元素到容器中,这些操作分别对应push_front、insert 和pu...
草上爬的头像-卡核草上爬
7119966
C++11并发学习之一:小试牛刀-卡核

C++11并发学习之一:小试牛刀

1.与C++11多线程相关的头文件 C++11 新标准中引入了四个头文件来支持多线程编程,他们分别是<atomic> ,<thread>,<mutex>,<condition_variable&...
草上爬的头像-卡核草上爬
7726529
C++11新特性之十四:std::async-卡核

C++11新特性之十四:std::async

如果你想异步地运行函数doAsyncWork,你有两个基本的选择。你可以创建一个std::thread,用它来运行doAsyncWork,这是基于线程(thread-based)的方法: in...
草上爬的头像-卡核草上爬
6277708
C++11新特性之十二:std::all_of, std::any_of, std::none_of-卡核

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) ...
草上爬的头像-卡核草上爬
5267393
C++11并发学习之二:线程管理-卡核

C++11并发学习之二:线程管理

1.启动线程 (1)使用对象 “小试牛刀”中thread构造时传入的是函数,还可以传入对象。 #include <thread> #include <iostream> void func() { std::cout<<"worker ...
草上爬的头像-卡核草上爬
7309628
C++11新特性之四:range-based for loops-卡核

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, ...
草上爬的头像-卡核草上爬
8794239