How to use intelligent pointer shared_ptr and weak_ptr in C language
This article mainly explains the "C language smart pointer shared_ptr and weak_ptr how to use", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "C language smart pointer shared_ptr and weak_ptr how to use" it!
The introduction of weak_ptr can solve the problem that resources cannot be released when shared_ptr cross-references are made.
Sample code:
# include # include using namespace std;class Bacy class A {public: a () {cout