上一页 1 ··· 8 9 10 11 12 13 14 15 下一页
摘要: c++ efficient 的第六章,看书笔记,顺便说下理解。对于一般直接 new 与delete 性能较差,可以自己管理写内存的申请与释放。版本0:class Rational{public: Rational(int a=0, int b =1 ): n(a),d(b){}private: int n; int d;};版本1: 专用的内存管理器这版本是通过重载 目标类 中的new 与delete 实现内存管理,只适用于目标类,但是速度是最快的。实现方式是维护一个链表,类中静态声明链表头,链表维护一串空间,通过类型转换在 目标类 和 链表指针 之间转换。如果内存不够(fr... 阅读全文
posted @ 2012-07-15 20:48 A_zhu 阅读(2220) 评论(0) 推荐(0) 编辑
摘要: 说个题外话#include <iostream>using namespace std;class A{public: char a; char b; char c;public: A(char aa, char bb=97, char cc=97):a(aa),b(bb),c(cc){}};int main(){ A e=98; cout<<e.a<<e.b<<e.c<<endl; return 0;}对于 下面的 A e= 98; 是能够匹配到A的构造函数的,aa 需不需要默认值都可以,这样的声明会将 98 赋予第一个 参数,即a 阅读全文
posted @ 2012-07-14 15:47 A_zhu 阅读(750) 评论(0) 推荐(0) 编辑
摘要: 返回值优化,是一种属于编译器的技术,它通过转换源代码和对象的创建来加快源代码的执行速度。RVO = return value optimization。class Complex//复数{ friendd Complex operator + (const Complex & , const Complex&);public: Conplex(double r=0.0,double i= 0.0): real(r),imag(i){} Complex(const Complex& a):real(a.real),imag(a.imag){}; Complex opera 阅读全文
posted @ 2012-07-14 14:49 A_zhu 阅读(3393) 评论(2) 推荐(1) 编辑
摘要: 再看 efficient c++, 写一下笔记。这是写第一章:跟踪实例。主要讲一个类,用于跟中,有一个公共变量控制是否需要跟踪,跟踪什么这个看个人要求,通过怎么实现跟踪类能够达到消耗最低。//初始版本class Trace{public: Trace(const string &name); ~Trace(); void debug(const string &msg); static bool traceIsActive;private: string theFunctionName;};inlineTrace::Trace(const string &name... 阅读全文
posted @ 2012-07-14 14:20 A_zhu 阅读(462) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include using namespace std;int fun1(int value){ return value*2;}int fun2(int value1,int val... 阅读全文
posted @ 2012-07-11 15:45 A_zhu 阅读(2329) 评论(0) 推荐(0) 编辑
摘要: 字符串输入输出流,istringstream、ostringstream,可以将输入或输出变成一个string,多次读写或多次输出。 也可以通过这两个实现变量类型的转换,如int 型数据输出到ss(stringstream),然后读取到string 中。#include <iostream>#include <sstream>#include <windows.h>using namespace std;int main(){ string buf; getline(cin,buf);/* 这个可以结合一下语句在处理文件读取时使用,先读整行,然后像cin处理 阅读全文
posted @ 2012-07-11 15:43 A_zhu 阅读(2995) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>using namespace std;template<class T>struct Unit{ public: Unit * next; T value;};template<class T>class MyLink{public: class LinkIterator { private: Unit<T> * init; public: LinkIterator(Unit<T> * init) { this->init=init; ... 阅读全文
posted @ 2012-07-11 15:42 A_zhu 阅读(2790) 评论(0) 推荐(0) 编辑
摘要: 记录 RECORD只能在PL/SQL 中运行处理单行数据,它可以用来表示一行数据,数据的类型可以自己定义,也可以基于表来定义,相对于包、对象、嵌套表来说,他也能创建多个属性来保存数据,但是他只能一行,不像嵌套表那样可以无限行,也不能声明内部函数。其实就是几个数据排成一行的统一操作而已。创建PL/SQL RECORD不像对象 、嵌套表,可以 用CREATE TYPE ,然后可以多次使用,RECORD 只能在pl块中定义DECLARE TYPE record_type IS RECORD( var_name1 type [,var_name2 type…] ); record_n... 阅读全文
posted @ 2012-04-19 23:47 A_zhu 阅读(5463) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/hackbuteer1/article/details/68233294、可用来检测一个web服务器是否正常工作的命令是()A、ping B、tracertC、telnet D、ftp只有C可以测试Web主机的网页服务器是否工作正常,假设该服务器的网页服务器使用的是默认端口,则可以使用命令telnet hostname 80 来测试其是否工作。5、下面哪个操作是Windows独有的I/O技术()A、Select B、PollC、IOCP D、Epoll6、IPV6地址包含了()位A、16 B、32 C、64D、1287、数据库里建索引常用的数据结构是( 阅读全文
posted @ 2012-04-18 21:20 A_zhu 阅读(787) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/hackbuteer1/article/details/68782871、下面的排序算法中,初始数据集的排列顺序对算法的性能无影响的是(B)A、插入排序B、堆排序 C、冒泡排序 D、快速排序2、以下关于Cache的叙述中,正确的是(B)A、CPU中的Cache容量应大于CPU之外的Cache容量B、Cache的设计思想是在合理成本下提高命中率C、Cache的设计目标是容量尽可能与主存容量相等D、在容量确定的情况下,替换算法的时间复杂度是影响Cache命中率的关键因素3、数据存储在磁盘上的排列方式会影响I/O服务的性能,一个圆环的磁道上有10个物理块,1 阅读全文
posted @ 2012-04-18 17:01 A_zhu 阅读(345) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 下一页