您当前的位置: 首页 >  令狐掌门 c++

C++ boost库智能指针(三):weak_ptr

令狐掌门 发布时间:2020-06-22 23:19:07 ,浏览量:1

        weak_ptr是shared_ptr得到协助者,可以观察shared_ptr是否过期,weak_ptr不改变引用计数,也不能使用 *,->操作符,是一个很弱的智能指针。例如下面的代码:

#include 
#include 
#include 

using namespace std;
using namespace boost;

class test
{
public:
	test()
	{
		cout             
关注
打赏
1688896170
查看更多评论
0.0920s