What is benefits of assigning shared pointer to weak pointer ?
Solved
C++ Gurus
-
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 ?
-
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.