posts - 2,  comments - 3,  trackbacks - 0

记录一下,刚学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 阅读(13750) 评论(3)  编辑 收藏 引用 所属分类: C++ 类

FeedBack:
# re: C++ vector指针
2012-03-07 10:40 | gaoxw
很好的解释,正在用,谢谢了!  回复  更多评论
  
# re: C++ vector指针
2012-04-28 16:46 | 飞天奶牛
vector<string>**
其实你可以理解为三维指针……  回复  更多评论
  
# re: C++ vector指针
2012-09-02 21:27 | ADRIANPreston19
Some time before, I needed to buy a good car for my organization but I didn't earn enough money and couldn't order something. Thank goodness my mate adviced to try to take the <a href="http://goodfinance-blog.com/topics/credit-loans">credit loans</a> from reliable creditors. Therefore, I did so and was satisfied with my collateral loan.   回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理


<2012年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

常用链接

留言簿

文章分类(46)

文章档案(33)

ACM

Algorithm Link

BLOG

Format analysis

Forum

Math

mirror

OpenGL

Protocol Analyzer

Recent Contests

Search

WIN32 Programming

最新随笔

搜索

  •  

最新评论

阅读排行榜

评论排行榜