记录一下,刚学vector ...
vector<string> S1(10);
/** 一维*/
vector<string>* A1 = new vector<string>(10);
/** 二维, 写成这样vector<string>** 我还不知道怎么神马意思... */
vector<vector<string>*> *A2 = new vector<vector<string>*>(2);
S1[0] = "000000000";
(*A1)[0] = "11111"; /** 还不理解,A1[0] 和 (*A1)[0], 不过A1[0]编译错误*/
(*A2)[0] = &S1;
(*A2)[1] = new vector<string>(10);/** 二维 同不理解 A2[1] 和 (*A2)[1]*/
(*((*A2)[1]))[0] = "ttttttttttt";
cout<<(*A1)[0]<<endl;
cout<<(*((*A2)[0]))[0]<<endl;
cout<<(*((*A2)[1]))[0]<<endl;
delete A1;
delete (*A2)[1];
delete A2;
posted on 2011-06-28 17:11
Lshain 阅读(13747)
评论(3) 编辑 收藏 引用 所属分类:
C++ 类