由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - BOOST里的shared ptr比stl里的auto ptr好在哪里呢?
相关主题
一般电面C++会问到什么专业问题?又问几个c语言编程的题目
C++ or Java问个static STL container的问题
想自学c++,现在巨土的问题问一下array contains two integer that sum up to 7
问几个面试题帮我看看这两个题目回答
Interview QuestionCareerCup 13.9的solution有memory leak
面试号称自己懂C++会不会被问STL问题贴面经, mobile小公司
攒人品 贴个Bloomberg phone interview.std::list如何检测环?
ANY IDEA?问一个smart pointer的问题
相关话题的讨论汇总
话题: ptr话题: auto话题: boost话题: shared话题: stl
进入JobHunting版参与讨论
1 (共1页)
d********t
发帖数: 9628
1
请大侠们不吝赐教!
l*****a
发帖数: 14598
2
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 的大作中提到】
: 请大侠们不吝赐教!
q****x
发帖数: 7404
3
google

【在 d********t 的大作中提到】
: 请大侠们不吝赐教!
d********t
发帖数: 9628
4
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

r****t
发帖数: 10904
5
different approaches towards resource bookkeeping, resulting in different copy behaviors.
n**e
发帖数: 116
6
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.
d********t
发帖数: 9628
7
唉,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.

1 (共1页)
进入JobHunting版参与讨论
相关主题
问一个smart pointer的问题Interview Question
弱弱的问问hash, hashtable?面试号称自己懂C++会不会被问STL问题
不行了,刚面完个烙印,上来发泄一下攒人品 贴个Bloomberg phone interview.
Bloomberg终于来信了……ANY IDEA?
一般电面C++会问到什么专业问题?又问几个c语言编程的题目
C++ or Java问个static STL container的问题
想自学c++,现在巨土的问题问一下array contains two integer that sum up to 7
问几个面试题帮我看看这两个题目回答
相关话题的讨论汇总
话题: ptr话题: auto话题: boost话题: shared话题: stl