2015年6月2日

类的常识

摘要: 1 /* 空类 */ 2 3 // 空类占一个字节 表明类存在 4 // 空类有int 占4个字节 5 // 空类代码不计入sizeof 6 class kong 7 { 8 public: 9 //int num;10 void go(int num)11 {12 ... 阅读全文

posted @ 2015-06-02 21:27 Dragon-wuxl 阅读(89) 评论(0) 推荐(0)

Cpp 结构体

摘要: 1 /* Cpp 结构体 */ 2 3 #include 4 5 struct lstruct 6 { 7 int num; 8 }; 9 10 // c++ 结构体会给默认的值11 struct MyStruct12 {13 int num;14 double db ... 阅读全文

posted @ 2015-06-02 16:50 Dragon-wuxl 阅读(456) 评论(0) 推荐(0)

调试以及静态断言

摘要: /* 调试以及静态断言 */#include#include#includeusing namespace std;int main(){ int num = 100; cout = 4,"error"); } 阅读全文

posted @ 2015-06-02 15:18 Dragon-wuxl 阅读(113) 评论(0) 推荐(0)

CPP 多线程

摘要: 1 /* CPP 多线程 */ 2 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 using namespace std::this_thread;10 11 void msg()12 {13 ... 阅读全文

posted @ 2015-06-02 14:50 Dragon-wuxl 阅读(243) 评论(0) 推荐(0)

智能指针

摘要: 1 /* 智能指针 */ 2 3 #include 4 5 int main() 6 { 7 //auto_ptr; 8 9 for (int i=0;i autop(p);// 创建智能指针,管理指针p指向的内存15 }16 17 std::cin.... 阅读全文

posted @ 2015-06-02 12:36 Dragon-wuxl 阅读(99) 评论(0) 推荐(0)

模板元编程

摘要: 1 /* 模板元编程 */ 2 3 // 模板元 就是把运行时消耗的时间在编译期间进行优化 4 5 #include 6 7 8 template 9 struct data10 {11 enum {res = data::res+data::res};12 13 };14 15... 阅读全文

posted @ 2015-06-02 12:14 Dragon-wuxl 阅读(165) 评论(0) 推荐(0)

using别名

摘要: 1 /* using别名 */ 2 3 #include 4 5 namespace space // 隔离模板 避免冲突 6 { 7 8 template using ptr = T*;// 模板简写 9 10 }11 12 int add(int a,int b)13 {... 阅读全文

posted @ 2015-06-02 10:45 Dragon-wuxl 阅读(162) 评论(0) 推荐(0)

去掉转义

摘要: 1 /* 去掉转义字符 */ 2 3 #include 4 #include 5 #include 6 7 int main() 8 { // R"()" 括号之间去掉转义字符 9 std::string path = R"("D:\Program Files (x86)\Ten... 阅读全文

posted @ 2015-06-02 10:10 Dragon-wuxl 阅读(162) 评论(0) 推荐(0)

导航