- 博客(4)
- 收藏
- 关注
转载 auto_ptr用法
1. auto_ptr的意义auto_ptr是一种智能指针,当系统异常退出的时候避免资源泄漏(内存)。其他的资源还对应其他的智能指针。2 auto_ptr的使用std::auto_ptr test(new int(1));test将是一个auto_ptr的对象,使用一个int指针进行初始化。test可以象其他指针一样使用,如使用* 使用->但是++不可以使用,以后也许
2013-04-11 20:46:50
608
转载 二叉查找数的C++实现
///////////////头文件定义#include using namespace std;template class BinarySearchTree{public: BinarySearchTree( ); BinarySearchTree (const BinarySearchTree & rhs); ~BinarySearchTree();
2013-03-21 12:18:24
410
转载 struct和typedef struct的比较
分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef:typedefstruct Student{int a;}Stu; 于是在声明变量的时候就可:Stu stu1;(如果没有typedef就必须用structStudent stu1;来声明) 这里的Stu实际上就是struct Student的别名
2013-03-21 12:09:25
522
转载 AVL树(C++模块实现)
AVL树又叫自平衡二叉查找树,在效率上不比红黑树,但是是红黑树的基础!下面是构造一棵AVL树的完整代码!//AVLTree.h//参考:http://www.cppblog.com/goodwin/archive/2011/08/08/152797.html#ifndef _AVLTREE_H_#define _AVLTREE_H_#include "Stack.h
2013-03-21 11:56:58
521
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人