C++标准库
wqfhenanxc
这个作者很懒,什么都没留下…
展开
-
C++ ABI、libstdc++
C++ Standard Library: ABI 与 APIAPI: Application Programing Interface,The C++ Standard Library has many include files, types defined in those include files, specific named functions, and other behavior. The text of these behaviors, as written in source原创 2020-12-17 14:46:13 · 1036 阅读 · 0 评论 -
A guide to getting started with boost::asio By Drew Benton 读后小结
A guide to getting started with boost::asio by Drew Benton 地址 https://www.gamedev.net/blogs/entry/2249317-a-guide-to-getting-started-with-boostasio/读后小结:io_service: 从boost v1.66起io_service变成了io...原创 2019-02-11 17:35:20 · 281 阅读 · 0 评论 -
boost::thread的六种使用方法总结
转载自https://blog.csdn.net/jack_20/article/details/79892250读后小结:第4,5,6中情况都是使用bind函数创造出来的函数用于执行线程。 boost::thread有两个构造函数: (1)thread():构造一个表示当前执行线程的线程对象; (2)explicit thread(const boost::function0&l...转载 2019-02-11 15:07:25 · 879 阅读 · 0 评论 -
boost asio学习资料
Boost.Asio的使用技巧 (中文 总结的非常好)http://blog.jqian.net/post/boost-asio.html?spm=a2c4e.11153940.blogcont243127.9.d8fc2f941Abbd7#toc_0boost.Asio的使用实践总结(英文 强烈推荐):https://www.gamedev.net/blogs/entry...原创 2019-02-15 08:56:02 · 577 阅读 · 0 评论 -
从boost转为c++11
从boost转为c++11随着boost的特性进入c++11,目前来看项目用到的boost库除了asio之外其他都可以转而使用std标准库。boost:bind :可以替换为std::bind, 但是最好不要再使用bind,而是使用lambda表达式。智能指针:boost::shared_ptr替换为std::shared_ptr; boost::...原创 2019-02-15 08:19:39 · 2144 阅读 · 0 评论 -
extern "C"的用法解析
转自 http://www.cnblogs.com/rollenholt/archive/2012/03/20/2409046.html 1.引言 C++语言的创建初衷是“a better C”,但是这并不意味着C++中类似C语言的全局变量和函数所采用的编译和连接方式与C语言完全相同。作为一种欲与C兼容的语言,C++保留了一部分过程式语言的特点(被世人称为“不彻底地面向对象”),...转载 2018-12-13 10:28:15 · 143 阅读 · 0 评论 -
BatchQueue数据结构
一个BatchQueue的实现:注意一下几点:1. Reader会使用pop/front函数,用到了begin_chunk, begin_pos, spare_chunk; Writer使用push/back函数。用到了end_chunk,end_pos, back_chunk, back_pos, spare_chunk; Reader和Writer唯一共用的变量是spar...原创 2018-12-06 11:39:30 · 565 阅读 · 0 评论 -
C++ 禁用复制构造函数和赋值运算符
Google的C++风格指南中3.3节有如下规定:可拷贝类型和可移动类型总述如果你的类型需要, 就让它们支持拷贝 / 移动. 否则, 就把隐式产生的拷贝和移动函数禁用.定义可拷贝类型允许对象在初始化时得到来自相同类型的另一对象的值, 或在赋值时被赋予相同类型的另一对象的值, 同时不改变源对象的值. 对于用户定义的类型, 拷贝操作一般通过拷贝构造函数与拷贝赋值操作符定义. str...原创 2018-12-06 10:06:36 · 4514 阅读 · 0 评论 -
SpscQueue数据结构
一个SpscQueue的实现。在Flush函数中将c赋值为f_item的值, 在CheckRead中prefetch时将r_item赋值为c的值。 /// Lock-free queue implementation./// Only a single thread can read from the queue at any specific moment./// ...原创 2018-12-08 14:24:01 · 941 阅读 · 0 评论 -
boost获取系统时间(毫秒级)
常用到的一段用boost读系统时间的代码:#include <boost/date_time/posix_time/posix_time.hpp> // Get current time from the clock, using microseconds resolution const boost::posix_time::ptime now ...转载 2018-08-21 16:17:50 · 7583 阅读 · 2 评论 -
enable_shared_from_this的用处
来自Stackoverflow的回答,很清晰地讲解了enable_shared_from_this所解决的用其他方法无法解决的问题。 https://stackoverflow.com/questions/712279/what-is-the-usefulness-of-enable-shared-from-thisfrom Dr Dobbs article on weak point...原创 2018-06-01 08:56:19 · 1911 阅读 · 4 评论 -
c++11 随机数
转自 https://www.cnblogs.com/egmkang/archive/2012/09/06/2673253.htmlC++11带来诸多特性,random就是其一.1. random_device 标准库提供了一个非确定性随机数生成设备.在Linux的实现中,是读取/dev/urandom设备;Windows的实现居然是用rand_s,在这里强烈谴责一下. random_devi...转载 2018-05-25 11:40:57 · 264 阅读 · 0 评论 -
C++ STL Containers cheat sheet
转自 http://en.cppreference.com/w/cpp/containerContainers library C++ Containers library The Containers library is a generic collection of class templates and alg转载 2018-01-06 13:29:15 · 719 阅读 · 0 评论 -
C++11 使用 unique_lock,lock_guard,condition_variable, lambda表达式实现线程安全队列
转自http://blog.csdn.net/tgxallen/article/details/73522233C++多线程编程中通常会对共享的数据进行写保护,以防止多线程在对共享数据成员进行读写时造成资源争抢导致程序出现未定义的行为。通常的做法是在修改共享数据成员的时候进行加锁--mutex。在使用锁的时候通常是在对共享数据进行修改之前进行lock操作,在写完之后再进行unlock操作,转载 2018-01-14 20:44:08 · 1839 阅读 · 0 评论 -
使用 C++11 编写 Linux 多线程程序
转自https://www.ibm.com/developerworks/cn/linux/1412_zhupx_thread/#ibm-pcon在这个多核时代,如何充分利用每个 CPU 内核是一个绕不开的话题,从需要为成千上万的用户同时提供服务的服务端应用程序,到需要同时打开十几个页面,每个页面都有几十上百个链接的 web 浏览器应用程序,从保持着几 t 甚或几 p 的数据的数据库系统,转载 2018-01-14 18:29:06 · 960 阅读 · 0 评论 -
C++ 用例
用例1: std::bind, std::for_each, std::vector, std::less#include #include #include #include class personal_info { std::string name_; std::string surname_; unsigned int age_; p原创 2018-01-03 22:37:40 · 397 阅读 · 0 评论 -
How the Boost Bind Library Can Improve Your C++ Programs
This chapter is from the book: Beyond the C++ Standard Library: An Introduction to Boost 注:c++11在标准库中引入了bind,因此以后要使用std::bind, std::bind其实就是从boost引入的,所以用法基本没有区别。本文讲解得思路对理解和使用std::bind依旧十分有转载 2018-01-03 21:51:08 · 340 阅读 · 0 评论 -
C++ 标准库 Chapter 6 The Standard Template Libary
6.11. What is container?2. What is iterator?3. What is algorithms?4. The concept of STL is based on a separation of data and operations. (Container, algorithms, iterator)6.21. what is原创 2014-03-09 21:26:24 · 637 阅读 · 0 评论