C++11

C++11新特性之八:smart pointers-卡核

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

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

C++11的重大改变

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

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

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

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

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

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

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

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

如果你想异步地运行函数doAsyncWork,你有两个基本的选择。你可以创建一个std::thread,用它来运行doAsyncWork,这是基于线程(thread-based)的方法: in...
草上爬的头像-卡核草上爬
6182708
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) ...
草上爬的头像-卡核草上爬
5169393
C++11并发学习之二:线程管理-卡核

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

1.启动线程 (1)使用对象 “小试牛刀”中thread构造时传入的是函数,还可以传入对象。 #include <thread> #include <iostream> void func() { std::cout<<"worker ...
草上爬的头像-卡核草上爬
7223628