C++11 智能指针之shared_ptr代码详解

2020-06-08 12:00:13于丽

示例:

int main() {
 shared_ptr<string> pStr = make_shared<string>(10, 'a');
 cout << pStr.unique() << endl; // true

 shared_ptr<string> pStr2(pStr);
 cout << pStr2.unique() << endl; // false;
}

总结

到此这篇关于C++11 智能指针之shared_ptr代码详解的文章就介绍到这了,更多相关 C++11 shared_ptr内容请搜索易采站长站以前的文章或继续浏览下面的相关文章希望大家以后多多支持易采站长站!