代码改变世界

阅读排行榜

MySQL 基本操作

2015-09-08 18:39 by sylar_liang, 158 阅读, 收藏,
摘要: 1. show databases; // 显示数据库2. use db_passport; // 使用db_passport数据库3. 创建表create table tb_access( aid int unsigned not null primary key, status tinyint ... 阅读全文

设计模式(7)--模板模式

2016-11-04 00:08 by sylar_liang, 156 阅读, 收藏,
摘要: //7.模板模式 //ver1 //考试试卷类 class TestPaper { public: void TestQuestion1(){} void TestQuestion2(){} virtual string Answer1() { return ""; } virtual string Answer2() { return ""; } }; class ... 阅读全文

字节对齐

2015-03-26 15:11 by sylar_liang, 154 阅读, 收藏,
摘要: #define APR_ALIGN(size, boundary) / (((size) + ((boundary) - 1)) & ~((boundary) - 1))该宏目的为: 计算出最接近size的boundary的整数倍的整数.如:APR_AGLIN(7,4) = 8. 即 (7+3) &... 阅读全文

auto_ptr 用例1

2015-03-10 17:45 by sylar_liang, 153 阅读, 收藏,
摘要: auto_ptr // 头文件 std::auto_ptr ptr1(new ClassA); // okstd::auto_ptr ptr2 = new ClassA; // error 不允许 赋值(assign)初始化方式auto_ptr赋值会导致所有权的转移auto_ptr错误运用:1.au... 阅读全文

一些常用的基础函数实现

2015-06-09 22:35 by sylar_liang, 145 阅读, 收藏,
摘要: 1.求公约数// return the greatest common divisorint gcd(int v1, int v2){ while(v2) { int temp = v2; v2 = v1%v2; v1 = temp; } return v1;}2. 阅读全文