c++的类模板

Posted on 十二月 16th, 2008 in Program | No Comments »

c++的类模板中有一些要注意的地方:
1、除非编译器实现了export关键字,否则将模板成员函数放置在一个独立的实现文件中将无法运行。(在GCC中,就是无法连接,编译可以通过)
因为模板不是函数,它们不能单独编译。模板必须与特定的模板实例化请求一起使用。

2、在类模板的操作符重载的友元函数中,要先声明,如<<操作符,要在函数后添加一对<>符合:

template <class T>
class Matrix;
template <class T>
ostream& operator <<(ostream& os,const Matrix<T>& matrix);

template <class T>
class Matrix
{
public:
friend ostream& operator << <>(ostream& os,const Matrix<T>& matrix);
}

而+-*/等操作符的友元重载则需要定义在类声明内部,否则连接会出错。

php的http类

Posted on 十二月 25th, 2004 in Program | 评论关闭

一个好用的http类,只有一个文件,适合很小的程序使用,可以用来模拟POST,支持文件上传和Cookie。
若以后要实现EDD的跨平台PHP方案,可能会使用此类.

http://new21.mirrors.phpclasses.org/browse/package/576.html