便利vector_使用std::vector 的陷阱

评论

# re: 使用std::vector 的陷阱  回复  更多评论

不明白为什么成员变量是指针就把指针所指的地方析构,是你的类实现的问题吗?

int *p1 = new int(1);

int *p2 = p1;

vector< int* > ivec;

ivec.push_back(p1);

ivec.push_back(p2);

当我把vector中的p2 erase掉之后,p1所指无物?

2009-09-03 09:20 | nelson

# re: 使用std::vector 的陷阱[未登录]  回复  更多评论

其实我觉得这不是vector给你设的“陷阱”,STL容器只有责任维护你给他的东西,但没理由维护这个东西里面的东西。不仅仅是vector,STL所有的容器如果按你这种思维去用,都会出问题:

class Test

{

int *a;

~Test()

{

delete a;

}

};

std::vector 维护Test::a其实应该是你的责任。

2009-09-03 13:37 | Kevin Lynx

# re: 使用std::vector 的陷阱  回复  更多评论

所有容器里面都应该只存储简单数据结构,一旦数据结构为复杂数据结构时,则应该存储该数据的指针。

2009-09-15 16:55 | davidfan

# re: 使用std::vector 的陷阱  回复  更多评论

Last time I downloaded the mp ringtones with the help of the ringtones site and used to be completely satisfied.

2010-06-24 17:54 | ConnerThelma30

# re: 使用std::vector 的陷阱  回复  更多评论

I think that you really know how not easy could the custom term paper creating be. But, you shouldn’t be confused, simply because the term paper writing services present the do my essay papers and there’s no problem to buy custom writing services and be satisfied.

2010-09-28 17:58 | buy essays cheap

# re: 使用std::vector 的陷阱  回复  更多评论

Frequently, that is better to buy essays, particularly if you do not have an opportunity to compose even an easy academic task.

2010-12-10 20:13 | custom essays

# re: 使用std::vector 的陷阱  回复  更多评论

Excellent post. I was checking continuously this blog and I'm impressed! Very useful information specifically the last part :) I care for such info a lot. I was looking for this certain information for a very long time. Thank you and good luck.

2013-10-03 07:48 | have a peek here

# re: 使用std::vector 的陷阱  回复  更多评论

I do not even understand how I stopped up here, but I assumed this publish used to be good. I don't realize who you might be but certainly you're going to a well-known blogger if you aren't already ;) Cheers!

2013-10-22 17:32 | agen bola

# re: 使用std::vector 的陷阱  回复  更多评论

I like the valuable info you provide in your articles. I'll bookmark your weblog and check again here frequently. I'm quite certain I'll learn a lot of new stuff right here! Best of luck for the next!

2013-11-08 10:14 | Navigate Here

# re: 使用std::vector 的陷阱  回复  更多评论

但没理由维护这个东西里面的东西。不仅仅是vector,所有的容器如果按你这种思维去用,都会出问题 为复杂数据结构时,则应该存储该数据

2014-09-10 21:40 | Agen Tangkas

# re: 使用std::vector 的陷阱  回复  更多评论

果按你这种思维去用,都会出问题 为复杂数据结构时,则应该

http://uefa88.net

# re: 使用std::vector 的陷阱  回复  更多评论

实应该是你的责任。的容器如果按你员变量是指针就把指针所指的地方析构

http://www.sidikjaritermurah.com

# re: 使用std::vector 的陷阱  回复  更多评论

一旦数据结构为复杂数据结构时,则应该存储该数据的指针。

http://multibet88.org

2014-10-16 03:22 | judi online

# re: 使用std::vector 的陷阱  回复  更多评论

http://agent108.org

2014-10-16 16:16 | judi bola

# re: 使用std::vector 的陷阱  回复  更多评论

则应该存储该数据的指针。

http://homebet88.com

# re: 使用std::vector 的陷阱  回复  更多评论

都会出问题 为复杂数 http://citibet88.com

2014-10-16 16:18 | taruhan bola

# re: 使用std::vector 的陷阱  回复  更多评论

一旦数据结构为复杂数据结构时 http://speedbet88.com

2014-10-16 16:19 | agen bola

# re: 使用std::vector 的陷阱  回复  更多评论

但没理由维护这个东西里面的东西。所有的容器如果按你这种思维去用,则应该存储该数据 http://www.speedbet88.biz

2014-10-25 03:24 | agen bola

# # re: 使用std::vector 的陷阱 回复 更多评论   回复  更多评论

我們的朱迪·博拉網最好的,最大的,最可靠的agent108 - 給促銷獎金10萬每存款將獲得5%的獎金

存取速度非常快,馬上加入我們的行列。

2014-10-28 17:30 | milestone

# re: 使用std::vector 的陷阱  回复  更多评论

但没理由维护这个东西里面的东西。所有的容器如果按你这种思维去用,则应该存储该数据 http://www.citibet88.com

2014-10-29 18:03 | taruhan bola

# re: 使用std::vector 的陷阱  回复  更多评论

很不错的博客,谢谢分享这个非常有趣的信息。保持成功

2014-11-18 22:03 | sbobet online

# re: 使用std::vector 的陷阱  回复  更多评论

但没理由维护这个东西里面的东西。所有的容器如果按你这种思维去用,则应该存储该数据

# re: 使用std::vector 的陷阱  回复  更多评论

www.on303.com adalah agen judi bola terpercaya di indonesia , dengan customer service yang ramah siap membantu anda semua.

2015-07-14 13:42 | judi bola

# re: 使用std::vector 的陷阱  回复  更多评论

この記事では、読者のために非常に良いと便利です。知識の共有をありがとうございました

# re: 使用std::vector 的陷阱  回复  更多评论

私のような初心者のための読書の多くを必要とし、様々なブログ上の情報を検索します。あなたはとても素敵を共有し、私を鼓舞し、記事

# re: 使用std::vector 的陷阱  回复  更多评论

容器只有责任维护你给他的东西,但没理由维护这个东西里面的东西。不仅仅是vector,STL所有的容器如果按你这种思维去用

# re: 使用std::vector 的陷阱  回复  更多评论

如果有引用记数的话,如智能指针, 就不会被释放掉了。不过如果一般编码里面不需要用到引用记数的话,还是方法1比较简便

# re: 使用std::vector 的陷阱  回复  更多评论

Mate this is a very nice blog here. I wanted to comment & say that I enjoyed reading your posts & they are all very well written out. You make blogging look easy lol I’ll attemp to start a blog later today and I hope it’s half as good as your blog! Much success to you!

# re: 使用std::vector 的陷阱  回复  更多评论

I would like to start a pressure group of Australian authors whose purpose is to remind the buyers at Council Libraries that one of their functions is to support and nurture Australian Literature.

2016-06-16 11:14 | klinik apotik24

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值