上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 66 下一页
摘要: #include template T max(T x, T y) { return x > y ? x : y; } //函数模板特化 template const char* max(const char* x, const char* y){ return strcmp(x, y) > 0 ? x : y; } int main(){ std::cout ... 阅读全文
posted @ 2016-12-03 21:11 zzyoucan 阅读(1212) 评论(0) 推荐(0) 编辑
摘要: 注意编译的时候gcc -o * *.c -levent 需要加上-levent链接库 阅读全文
posted @ 2016-10-17 00:33 zzyoucan 阅读(792) 评论(0) 推荐(0) 编辑
摘要: wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz tar –xzvf libevent-1.4.13-stable.tar.gz cd libevent-1.4.13-stable ./configure --prefix=/h 阅读全文
posted @ 2016-10-17 00:19 zzyoucan 阅读(1536) 评论(0) 推荐(0) 编辑
摘要: private成员,也被继承下来,只是不能访问 阅读全文
posted @ 2016-10-16 12:15 zzyoucan 阅读(107) 评论(0) 推荐(0) 编辑
摘要: //每次写代码总是被迭代器的iter->和*iter弄晕,主要是被protobuf弄晕了 #include struct test{ test(){ memset(this, 0, sizeof(test)); } int a; int b; }; int main() { test a, b; a.a = a.b = 0;... 阅读全文
posted @ 2016-10-15 11:49 zzyoucan 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 1.先用:ls -al /usr/lib | grep libevent 查看是否已安装,如果已安装且版本低于1.3,则先通过:rpm -e libevent —nodeps 进行卸载。 2.下载libevent安装包:libevent-1.4.13-stable.tar.gz,然后解压。 3.切换 阅读全文
posted @ 2016-10-12 23:33 zzyoucan 阅读(312) 评论(0) 推荐(0) 编辑
摘要: class Rational{ public: const Rational operator*( const Rational& rhs); Rational(int num); private: int a; }; Rational::Rational(int num) :a(num) { } const Rational Rational::operator*(... 阅读全文
posted @ 2016-10-11 23:58 zzyoucan 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 以前对于指针直接比较总是不放心,包括std::find用法总感觉不放心,后面发现这种用法是可以的 阅读全文
posted @ 2016-10-07 21:47 zzyoucan 阅读(177) 评论(0) 推荐(0) 编辑
摘要: #include void fun(int** a) { *a = 0;//改变指针的值 } void fun(int*& a) { a = 0;//改变指针的值 } int main() { int a = 90; int* p = &a; fun(p); return 0; } 阅读全文
posted @ 2016-10-07 21:39 zzyoucan 阅读(289) 评论(0) 推荐(0) 编辑
摘要: #include void fun(int* a, int num) { for (int i = 0; i < num; ++i) { std::cout << a[i] << " "; } } int main() { int a[5] = {0, 1, 2, 3, 4}; fun(a, 5);//数组名弱化为指针 retu... 阅读全文
posted @ 2016-10-07 21:24 zzyoucan 阅读(372) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 66 下一页