- 博客(6)
- 问答 (1)
- 收藏
- 关注
原创 C++ Read a whole File using ifstream
std::ifstream ifs("filename.txt"); std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); Mind the extra parenthesis in the str declaration, it's necessary for correct p
2015-08-17 20:16:55 480
原创 代码格式工具
1) astyle 安装方法 apt-get install astyle 2) indent apt-get install indent
2015-08-17 17:52:57 350
原创 Windows 上使用cmake
1. 安装一款C/C++编译器 例如 VS系列, Mingw系列, Dev-C++系列 2. 安装CMake 3. 安装make 4. 设置好他们的环境变量 5. 编写测试文件 hello.cpp #include int main() { int d; printf("hello world."); scanf("%d", &d); getchar(); re
2015-08-14 11:59:31 286
原创 APR 内存池
#include #include int main() { apr_pool_t *pool; apr_status rv; char *buf; rv = apr_initialize(); if (rv != APR_SUCCESS) { return -1; } rv = apr_pool_create(&po
2015-08-13 20:27:50 316
原创 用boost::shared_ptr 进行数据管理
我们经常遇到这样的情况, 类A和类B同时需要使用类C这个数据。那么类C这个数据由谁来存储呢? 比如:有个Student A, Class C(班级), Student Union SU(学生会), 这个学生A既可能是班级C的一员,也可能是学生会SU的一员。 下面是一个demo。 #include #include #include #include class Student { p
2015-08-10 18:04:03 371
空空如也
这样设计继承有什么好处?
2015-06-10
TA创建的收藏夹 TA关注的收藏夹
TA关注的人