
C/C++
孤城飛雪
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++线程安全的单例模式
/*** @brief C++线程安全的单例模式*/#include <iostream>#include <mutex>class Singleton{private: ///构造析构定义为私有,防止外部实例化对象 Singleton() { std::cout << "Singleton construct" <&...原创 2019-08-05 09:33:36 · 209 阅读 · 0 评论 -
C++移动构造
写个Demo测试一下C++移动构造的效果(对于节省空间、提高效果很有用),使用了std::move和std::forward。#include <iostream>#include <string.h>class myString{public: //单参构造函数 myString(const char* data = NULL);...原创 2019-08-02 09:59:56 · 522 阅读 · 0 评论 -
C++内存池与线程池
最近写代码的时候图省事大量使用new、delete,后来抽空再git上面搜索了排名靠前的内存池和线程池的C++实现。1)内存池:https://github.com/cacay/MemoryPool比较了几种内存池的实现方式,发现该方法效率很高、值得赞一个。2)线程池:https://github.com/progschj/ThreadPool/blob/master/ThreadPo...原创 2019-06-19 19:39:31 · 879 阅读 · 0 评论