What is benefits of assigning shared pointer to weak pointer ?
-
wrote on 19 Jan 2023, 11:07 last edited by Qt embedded developer
My shared pointer is pointer which pointing to controller of MVC pattern and
My weak pointer is base class controller pointer.
so i want to know why my all controller's shared pointer of based class controller's weak pointer ?
And i also want to know purpose of base class controller in MVC pattern ?
-
wrote on 19 Jan 2023, 16:16 last edited by
shared pointer and weak pointer are there for memory management or lifetime management.
It has nothing to do with MVC.
The point of shared pointers is that they make sure your object is deleted only when the last one stops using that.
The point of a weak pointer is that they allow the object to be deleted which a shared pointer doesn't allow.
1/2