摘要: 0. libxml2 是个跨平台的C库,用于操作xml文件。API Reference。1.结构体: 1 /*文档结构体*/ 2 typedef xmlDoc *xmlDocPtr; 3 4 /*节点结构体*/ 5 typedef struct _xmlNode x... 阅读全文
posted @ 2015-06-30 23:07 J.Way.C 阅读(951) 评论(0) 推荐(0) 编辑
摘要: 1. 将一个十进制整数转换成任意进制(2-36)的整数:#include #include int Tentrans2any(char* out, int len, int number, int base) { if( !out || len 36 ) return 0; bool neg = ... 阅读全文
posted @ 2015-05-18 17:35 J.Way.C 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 1. Type Casting/* dynamic_cast: Can be used only with pointers and references to class; Base-to-derived conversions are not allowed unless the base cl... 阅读全文
posted @ 2013-05-07 15:00 J.Way.C 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 1. Function TemplatetemplateT1 max( T2& a, T3& b){ ... }// explicit call::max(1, 2.3);//or::max(1, 2.3); // return type is int // string literals as a... 阅读全文
posted @ 2013-04-27 17:11 J.Way.C 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 1. vtable 的基本运作 编译器不会为所有的类加入vtable,但是每个类只能有一个vtable,所有对象共享一个vtable。 类中会暗含一个vpinter来指向对应自己的vtable。sizeof(类) == sizeof(对象);struct Boo { int boo; vir... 阅读全文
posted @ 2013-03-29 17:32 J.Way.C 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 1. auto,自动检测变量初始化类型,有些地方用起来特别方便std::map addrBooks;// some inserting ...// iterate elemants// way before c11std::map::iterator it = addrBooks.begin();/... 阅读全文
posted @ 2013-03-29 11:35 J.Way.C 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1. How to use epoll ? A complete example in c.Link2. 14种时间复杂度对应的相关算法.Link3. Large-Scale C++ Software Design4. 14 lessons after 5 years of professional... 阅读全文
posted @ 2013-03-15 09:57 J.Way.C 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1. std::auto_ptrstruct A{ ~A(){printf("~A\n");}};void fun( std::auto_ptr tmp ){ printf("fun %p size%d\n", &(*tmp), sizeof(tmp));}int main(int argc, ch... 阅读全文
posted @ 2013-03-14 11:51 J.Way.C 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 1. forward declaration// Functionvoid fun(int); 在此之后的代码可以引用fun,而fun的定义必须在某个地方提供。// Variables may have only forward declaration and lack definition// D... 阅读全文
posted @ 2013-03-13 17:28 J.Way.C 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1. 区别 默认的成员,继承修饰,struct为public,class为private。2. 类和结构体的拷贝,赋值,在不涉及成员指针情况下可直接使用默认方式即可。3. 构造函数调用时机:Struct s; 拷贝构造时机:Struct s = other; 赋值函数时机:Sturct s; s =... 阅读全文
posted @ 2013-03-06 17:40 J.Way.C 阅读(133) 评论(0) 推荐(0) 编辑