当前位置:网站首页>Smart pointer shared_ PTR and weak_ Difference of PTR
Smart pointer shared_ PTR and weak_ Difference of PTR
2022-07-05 03:26:00 【Alex1_ Code】
weak_ptr To solve the problem shared_ptr The problem of circular quotation , Prevent bidirectional binding
1. share_ptr Example
Schematic diagram
It can be seen that , When ptr_a,ptr_b Release , Did not lead to A,B The construction of class .
2. Right up there Example improvements :
Schematic diagram
At this time, both class objects are destructed , meanwhile ptr_a Of use_count by 2,ptr_b Of use_count by 1
边栏推荐
- SQL performance optimization skills
- Returns the lowest common ancestor of two nodes in a binary tree
- Design and implementation of community hospital information system
- Watch the online press conference of tdengine community heroes and listen to TD hero talk about the legend of developers
- Mongodb common commands
- Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?
- VM in-depth learning (XXV) -class file overview
- [Yu Yue education] National Open University autumn 2018 8109-22t (1) monetary and banking reference questions
- Azkaban actual combat
- Simple use of devtools
猜你喜欢
Huawei MPLS experiment
el-select,el-option下拉选择框
About MySQL database connection exceptions
Pat grade a 1119 pre- and post order traversals (30 points)
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
College Students' innovation project management system
This + closure + scope interview question
Pat class a 1162 postfix expression
Yyds dry goods inventory embedded matrix
Anchor free series network yolox source code line by line explanation Part 2 (a total of 10, ensure to explain line by line, after reading, you can change the network at will, not just as a participan
随机推荐
[groovy] string (string splicing | multi line string)
Sqoop installation
The database and recharge are gone
Design and practice of kubernetes cluster and application monitoring scheme
Vb+access hotel service management system
How can we truncate the float64 type to a specific precision- How can we truncate float64 type to a particular precision?
Linux安装Redis
2. Common request methods
[groovy] string (string injection function | asBoolean | execute | minus)
Use UDP to send a JPEG image, and UPD will convert it into the mat format of OpenCV after receiving it
Design of kindergarten real-time monitoring and control system
Returns the lowest common ancestor of two nodes in a binary tree
Qrcode: generate QR code from text
Talk about the SQL server version of DTM sub transaction barrier function
Pat class a 1162 postfix expression
Single box check box
Kuboard
LeetCode146. LRU cache
IPv6 experiment
Design and implementation of community hospital information system