Mysql 中List的使用
(2011-12-16 18:48:03)
标签:
it |
分类: mysql源码相关 |
本文介绍mysql 中List的使用。 I_List是mysql自己封装的一个list对象, 并且mysql还封装了对应的iterator对象 I_List_iterator 。具体的代码可以在sql/sql_list.h中找到。
建立一个I_List
I_List<class> *var=new I_List<class>;
添加数据
class *a = new class;
var->push_back(a);
建立对应的iterator
I_List_iterator<class> it(*var);
遍历
class *tmp;
while((tmp=it++))
{
}
删除
delete tmp;