- 博客(8)
- 资源 (2)
- 收藏
- 关注
原创 boost 实用工具
1. noncopyable P1102. typeof P1123. optional P1164. assign5. swap6. singleton 单件模式7. boost.serialzation 单件模式8. tribool --基于三态的布尔逻辑9. operators P140
2017-02-27 16:38:03 284
原创 boost pool库
一. pool库 -> pool P100返回一个简单数据类型(POD)的内存指针,如int、double等. #include <boost/pool/pool.hpp> using namespace boost; int main() { pool<> pl(sizeof(int)); //一个可分配int的内存池
2017-02-27 15:05:46 238
原创 boost smart_prt 4-> shared_ptr
shared_ptr P84引用计数型的智能指针 shared_ptr spi(new int); assert(spi); *spi = 253; shared_ptr sps(new string(“smart”)); assert(sps->size() == 5);shared_ptr提供operator<比较操作符,可用于标准关联容器 #include <iostre
2017-02-26 12:00:10 505
原创 boost smart_ptr 3-> scoped_array
scoped_array P82 scoped_array 类似scoped_ptr,封装了new[]操作符,为动态数组提供了一个代理 scoped_array<int> sa(new int[100]); sa[0] = 10; *(sa+1) = 20; 除非对性能有非常苛刻的要求,或者编译器不支持标准库,否则不建议使用scoped_array.
2017-02-26 11:28:01 228
原创 boost smart_ptr -> scoped_ptr
smart_ptr 库概述 C++98 校准的“自动指针”:std::auto_ptr #include <boost/smart_ptr.hpp> using namespace boost; scoped_ptr P78 只能在本作用域内使用,不希望被转让。a. 不支持比较操作 b. .swap()交换两个scoped_ptr保存的原始指针,高效操作。sc
2017-02-25 12:36:26 366
原创 boost 时间与日期
要点一、timer库 P33timer #include <boost/timer.hpp>using namespace boost;progress_timer P36 继承自timer,析构时自动输出时间 #include <boost/progress.hpp>using namespace boost;//将progress_timer的输出转移到时stringst
2017-02-24 14:36:01 365
原创 boost::assert学习笔记
P213要点头文件 #include assert.hpp> 默认情况下BOOST_ASSERT宏等同于assert宏,断言表达式为真,即: #define BOOST_ASSERT(expr) assert(expr)。如果参数expr表达式值为true,那么断言成立,程序会继续向下执行,否则断言会引发一个异常。BOOST_ASSERT宏仅会在debug模式下生效。
2017-02-24 13:59:33 2053
原创 boost::format常用用法
p167 头文件#include <boost/format.hpp>using namespace boost;一个简单的例子#include <boost/format.hpp>using namespace boost;int main(){ cout<< format("%s:%d+%d=%d\n")%"sum"%1%2%(1+2); format fmt("(%1
2017-02-22 16:01:30 1552 1
AnkhSvn-2.5.
2014-06-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人