![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++(Boost)
langb2014
这个作者很懒,什么都没留下…
展开
-
Boost源码学习二[内存管理一]下
由于篇幅看着比较长所以把上一篇分成两块了。// instrusive_ptr.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include // 主要介绍的对象——智能指针intrusive_ptr头文件#include // Boost库提供的线程安全的原子计数器#include // 对指针进行静态检查的函数#includ原创 2015-10-23 13:45:50 · 972 阅读 · 0 评论 -
编译boost程序出现如下错误fatal error LNK1104: cannot open file 'libboost_system-vc100-mt-gd-1_54.lib'的解决方法
对于如下程序:[cpp] view plaincopyprint?#include #include #include using namespace std; int main() { boost::asio::io_service io; boost::asio::deadline_timer t(io, boost:转载 2016-01-15 13:10:37 · 2305 阅读 · 0 评论 -
vs2013的boost安装及配置
1、下载:Boost 1.59.0 并解压后打开bootstrap.bat文件2、双击运行boostrap.bat文件,自动执行完自动关闭,此时会发现文件夹下,增加了bjam.exe文件3、 双击运行该bjam.exe文件,它会自动执行,执行结束自动关闭,boost库初期安装完成。下面就是VS2013的配置了:1.先创建一个控制台空项目boost,然后右击添加文件main.cp原创 2015-10-16 16:30:35 · 5774 阅读 · 0 评论 -
Boost源码学习三[实用工具](4)
第四个是assign,#include using namespace std;#include /*assign:许多情况下我们都需要为容器初始化或者赋值,填入大量的数据,比如初始错误代码和错误信息,或者是一些测试用的数据。STL容器仅提供了容纳这些数据的方法,但填充的步骤却是相当地麻烦,必须重复调用insert()或者push_back()等成员函数,这正是boost.assig原创 2015-12-01 20:57:10 · 803 阅读 · 0 评论 -
Boost源码学习三[实用工具](3)
第三个学的是optional,按照Boost程序库开发指南中的介绍:optional的类摘要:template class optional{ public: optional (); optional (none_t); optional (T const& v); optional (bool condition, T v); optional &oper原创 2015-12-01 16:42:14 · 989 阅读 · 0 评论 -
Boost源码学习三[实用工具](2)
第二个学习的是ignore_unused,template inline void ignore_unused(Ts const& ...){}ignore_unused使用可变参数模板,可以支持任意数量,任意类型的变量,把它们作为函数的参数‘使用’了一下,骗过了编译器,达到了与(void)var相同的效果。#includeusing namespace boost;int f原创 2015-12-01 15:52:14 · 1265 阅读 · 0 评论 -
Boost源码学习三[实用工具](1)
这一节是一些比较实用的小工具,功能单纯,代码也简单。先学习的第一个就是noncopyable:#ifndef BOOST_NONCOPYABLE_HPP_INCLUDED#define BOOST_NONCOPYABLE_HPP_INCLUDEDnamespace boost {// Private copy constructor and copy assignment en原创 2015-12-01 14:57:20 · 840 阅读 · 0 评论 -
Boost源码学习二[内存管理二]
内存管理的另一个重要部分技术内存池,Boost库的pool提供了一个内存池分配器,用于管理在一个独立的、大的分配空间里的动态内存分配。Boost库的pool主要适用于快速分配同样大小的内存块,尤其是反复分配和释放同样大小的内存块的情况。使用pool内存池主要有以下两个优点: 1. 能够有效地管理许多小型对象的分配和释放工作,避免了自己去管理内存而产生的内存碎片和效率低下问题。原创 2015-10-23 20:46:14 · 1123 阅读 · 0 评论 -
Boost源码学习一[时间与日期]
#include #include #include #include #include #include #include "boost_test.h"using namespace std; using namespace boost;int main(){ //######timer 处理示例,timer 以处理几百小时之内,对精确度不高的时间统计。 timer t;原创 2015-10-07 20:26:52 · 1544 阅读 · 0 评论 -
Boost源码学习二[内存管理一]上
C++标准库中的auto_ptr,智能指针,部分的解决了获取资源自动释放的问题在Boost中,提供了6中智能指针:scoped_ptr, scoped_array, shared_ptr, shared_array, weak_ptr, instrusive_ptt,这些智能指针属于smart_ptr组件。先学习scoped_ptr:template class scoped_原创 2015-10-22 18:55:38 · 1509 阅读 · 0 评论 -
Boost源码学习二[内存管理一]中
接着一篇继续学习智能指针。。。。。。。。第四个学习的是shared_array指针:类摘要:template class shared_array{public: explicit shared_array(T *p = 0); template shared_array(T *p,D d); ~shared_array(); shared_array(原创 2015-10-23 13:27:12 · 1036 阅读 · 0 评论 -
Boost源码学习十一[并发编程](2)
头文件摘要71std::atomic_flag 类摘要namespace std { typedef struct atomic_flag { bool test_and_set(memory_order = memory_order_seq_cst) volatile; bool test_and_set(memory_order = me原创 2016-01-15 10:25:20 · 1409 阅读 · 0 评论