由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - smart pointer 一问
相关主题
琢磨了一下c++ smart pointer,发现不能到处用那位再提醒我一下,reference的好处是?
is smart_ptr really that good?a simple C++ question
int F::*x = &F::x是什么意思?c++ interview: iterator 和 pointer区别?
c++ 里用到pointer 的地方我们尽可能用smart pointer吗?[c++] reference 真得不能bound to a second object 么?
怎么检测c++ smart pointer的循环引用?stl的interator是一种smart pointer吗
python一问Smart Pointer
请问:Auto_Ptr、Smart Ptr 和 Reference Counting是什么关系? (转载)c++指针的问题
C++ interdependence question关于不同类型的smart pointer
相关话题的讨论汇总
话题: ptr话题: pointer话题: smart话题: object话题: auto
进入Programming版参与讨论
1 (共1页)
o*******0
发帖数: 699
1
smart pointer 实践是不是真的很有用呢?
比方说 auto_ptr, 你要把它定义在stack上,这样它才会自动消除。
可是知道把object定义在stack上,可能就不要auto_ptr了。
又比如说smart pointer with ref count. 要thread safe, 算错了还会死人。(那是
真查不出来的bug)
t****t
发帖数: 6806
2
auto_ptr is quite clumsy...use unique_ptr if you want unique reference.
or use shared_ptr. the point is, sometimes you don't have a clear "owner" of
the object, and you dunno who should release the object unless you track it
specifically. shared_ptr will help you do it. as for thread safe, usually i
rely on the library...

【在 o*******0 的大作中提到】
: smart pointer 实践是不是真的很有用呢?
: 比方说 auto_ptr, 你要把它定义在stack上,这样它才会自动消除。
: 可是知道把object定义在stack上,可能就不要auto_ptr了。
: 又比如说smart pointer with ref count. 要thread safe, 算错了还会死人。(那是
: 真查不出来的bug)

1 (共1页)
进入Programming版参与讨论
相关主题
关于不同类型的smart pointer怎么检测c++ smart pointer的循环引用?
C++的smart pointer注定是个二流的东西python一问
关于多个smart pointer系统并存的问题请问:Auto_Ptr、Smart Ptr 和 Reference Counting是什么关系? (转载)
c++里 weak_ptr用起来是不是耗时间?C++ interdependence question
琢磨了一下c++ smart pointer,发现不能到处用那位再提醒我一下,reference的好处是?
is smart_ptr really that good?a simple C++ question
int F::*x = &F::x是什么意思?c++ interview: iterator 和 pointer区别?
c++ 里用到pointer 的地方我们尽可能用smart pointer吗?[c++] reference 真得不能bound to a second object 么?
相关话题的讨论汇总
话题: ptr话题: pointer话题: smart话题: object话题: auto