08 2012 档案

摘要:class base{ public: int y; int z; int x; base():x(1){} void output() { printf("%d\n",x); printf("%p\n",(void *)this); printf("%d\n",this->x); }};class der :public base{ public: int x; der():x(2){}};int main(int argc,char **argv){ base x; de... 阅读全文
posted @ 2012-08-30 18:23 vsuu 阅读(183) 评论(0) 推荐(0)
摘要:在编程中经常用到 using namespace std和 using std::cout,这两个语句似乎干的是一样的工作--减少要敲的字母,但仔细推敲下来,它们的语义差别还是挺大的。View Code #include<cstdio>namespace test{ void output(){puts("namespace");}}void output(){puts("no namespace");}int main(int argc,char **argv){ output();//print "no namespace&qu 阅读全文
posted @ 2012-08-23 22:34 vsuu 阅读(332) 评论(0) 推荐(0)
摘要://最初实现的版本比lisp写的fact要慢很多(1/5的效率),多次优化后终于比lisp快了。还能怎么提高效率?// HugeInt.h: interface for the HugeInt class.#ifndef HUGEINT_H#define HUGEINT_H#include<iostream>#include<vector>class HugeInt{ enum {computebound=1000000000,computewidth=9}; typedef unsigned int eletype;public: HugeInt(); HugeI.. 阅读全文
posted @ 2012-08-21 09:47 vsuu 阅读(690) 评论(0) 推荐(0)
摘要:template<typename T>class BlackHoleIterator :public iterator<output_iterator_tag,T>{ typedef BlackHoleIterator<T> _Self;public: _Self &operator*(){return *this;} _Self &operator++(){return *this;} _Self &operator++(int){return *this;} _Self &operator=(const T &) 阅读全文
posted @ 2012-08-15 21:58 vsuu 阅读(127) 评论(0) 推荐(0)
摘要:utility: pair为具有两个public成员的类模板。 make_pair为一个模板函数,根据参数生成pair对象。 rel_ops为一个namespace,里面包含几个模板函数,可以由==、<推导出 !=、<=、>、>=,减少工作量。memory: auto_ptr智能指针类 1.内部指针操作: T* get()throw();返回指向的对象的指针 T* release()throw();返回指向的对象的指针,不再指向该对象 T* reset(T* =0)throw();指向另一个对象,之前指向的对象被delete掉 2.指针形为... 阅读全文
posted @ 2012-08-13 15:40 vsuu 阅读(204) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/code_see/article/details/6301768备注:1.系统环境变量中要有VC的环境变量,否则编译会进行不下去。include变量中添加D:\Program Files\Microsoft Visual Studio\VC98\ATL\Include;D:\Program Files\Microsoft Visual Studio\VC98\MFC\Include;D:\Program Files\Microsoft Visual Studio\VC98\Includelib变量中添加D:\Program Files\Microsof 阅读全文
posted @ 2012-08-13 09:14 vsuu 阅读(151) 评论(0) 推荐(0)