Redian新闻
>
BOOST里的shared ptr比stl里的auto ptr好在哪里呢?
avatar
BOOST里的shared ptr比stl里的auto ptr好在哪里呢?# JobHunting - 待字闺中
N*g
1
☆─────────────────────────────────────☆
unknowns (我怎么有这么多不知道的东西) 于 (Sun Jul 12 21:27:56 2009, 美东) 提到:
不怕, 我375收

我4个300的笔记本,断断续续列了1个半月才出,每台能赚几顿八肥罢了。今天staple
的笔记本,如果没拖打印机,自求多福
☆─────────────────────────────────────☆
mir (rebates) 于 (Sun Jul 12 21:27:58 2009, 美东) 提到:
我match班上最高价呀
现在不才375吗
staple
☆─────────────────────────────────────☆
gwrfxj (大灰狼) 于 (Sun Jul 12 21:37:14 2009, 美东) 提到:
墨神425收我几个吧,这样我就不用自己卖了
avatar
d*t
2
请大侠们不吝赐教!
avatar
l*a
3
auto_ptr v1(****);
auto_ptr v2=v1;
then v1 will not hold the pointer to the resource.
for share_ptr, you can have several objects to manage the same resource

【在 d********t 的大作中提到】
: 请大侠们不吝赐教!
avatar
q*x
4
google

【在 d********t 的大作中提到】
: 请大侠们不吝赐教!
avatar
d*t
5
Thanks!

【在 l*****a 的大作中提到】
: auto_ptr v1(****);
: auto_ptr v2=v1;
: then v1 will not hold the pointer to the resource.
: for share_ptr, you can have several objects to manage the same resource

avatar
r*t
6
different approaches towards resource bookkeeping, resulting in different copy behaviors.
avatar
n*e
7
boost shared_ptr is a reference counted smart pointer. It can be used in
standard containers, for example, std::vector >.
std::auto_ptr is not a reference counted smart pointer. It does NOT have
ownership, i.e, when a std::auto_ptr is assigned to another one, its
ownership is transferred. As a result, it can NOT be used in standard
containers.
avatar
d*t
8
唉,STL自己的smart pointer都不能用在自己的container里,太悲催了。

【在 n**e 的大作中提到】
: boost shared_ptr is a reference counted smart pointer. It can be used in
: standard containers, for example, std::vector >.
: std::auto_ptr is not a reference counted smart pointer. It does NOT have
: ownership, i.e, when a std::auto_ptr is assigned to another one, its
: ownership is transferred. As a result, it can NOT be used in standard
: containers.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。