Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. What is benefits of assigning shared pointer to weak pointer ?
Forum Updated to NodeBB v4.3 + New Features

What is benefits of assigning shared pointer to weak pointer ?

Scheduled Pinned Locked Moved Solved C++ Gurus
2 Posts 2 Posters 449 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on 19 Jan 2023, 11:07 last edited by Qt embedded developer
    #1

    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 ?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TomZ
      wrote on 19 Jan 2023, 16:16 last edited by
      #2

      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 Reply Last reply
      1

      1/2

      19 Jan 2023, 11:07

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved