64,654
社区成员
发帖
与我相关
我的任务
分享
typedef struct test
{
char c;
int t;
}test;
typedef list<test> one;
typedef list<one> line;
/*
下面是对line 和 one 里面的元素进行一些常用的操作,比如插入,查找,删除等
这里应该有对这个结构重载一些运算付以方便sort等操作把
*/
struct test
{
char c;
int t;
test(int t_=0,char c_=0):t(t_),c(c_){}
};
typedef list<test> one;
typedef list<one> line;
one one_;
line line_;
如果我这样了:
one_.push_back(test(1,'c'));
one_.push_back(test(1,'a'));
one_.push_back(test(1,'b'));
然后:
line_.push_back(one_);
如果我要对数据进行更新就必须重新把one_push进去。
但,如果用指针就不必这么麻烦了
翻一下stl源代码,
果然传递的都是对象。