摘要:
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 using namespace boost; 11 12 13 void print(std::ostream &os,int i)... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 using namespace boost; 11 12 13 //function函数包装器 14 void mainC() 15... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 9 //绑定函数的默认值,继承二进制函数类的所有类容 10 class add :public std::binary_function 11 { 12 13 public: 14 void ... 阅读全文
摘要:
myvector.h 1 #pragma once 2 3 //自己写的vector模板库 4 template <class T> 5 class myvector 6 { 7 public: 8 //构造 9 myvector(); 10 //析构 11 ~myvector(); 12 //尾插 阅读全文
摘要:
1 #include 2 #include 3 #include//区别 4 using namespace std; 5 6 void main() 7 { 8 boost::array myarray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; 9 boost::array::iterator ibegin = myarr... 阅读全文
摘要:
一、前言 好好研究下大名鼎鼎的Boost库。 二、Boost安装 2.1 Boost官网下载Boost最新版Version 1.55.0 2.2将下载压缩包解压到本地 解压后可看到目录下有个bootstrap.bat文件。 2.3打开cmd命令窗体,执行bootstra.bat文件 运行下面命令,详 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 void test() 8 { 9 shared_ptr P(new int[10]{ 1,2,3,4,5,6,7,8,9,0 }); 10 shared_ptr P1 = P; 11 ... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 //独享内存,其他指针不可以拥有 8 void test1() 9 { 10 //检测到没有调用的话就不分配内存 11 unique_ptr p(new int[10]{ 0 }); 12 //避免指针被... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 struct my 8 { 9 int x; 10 int y; 11 }; 12 13 //智能指针主要用于解决内存泄漏,拥有常规指针一样的使用,重载* ->运算符 14 void run1() 15 { 1... 阅读全文
摘要:
1 #include 2 using namespace std; 3 4 class myit 5 { 6 public: 7 static int num; 8 9 class itit 10 { 11 12 }; 13 }; 14 15 int myit::num = 0; 16 17 template 18 class my... 阅读全文