Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get QSharedPointer's Reference Count
Forum Updated to NodeBB v4.3 + New Features

Get QSharedPointer's Reference Count

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsharedpointer
4 Posts 2 Posters 3.2k Views 2 Watching
  • 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.
  • N Offline
    N Offline
    Nishant Sharma
    wrote on 20 Feb 2017, 05:39 last edited by
    #1

    Re: Get QSharedPointer's Reference Count

    Hi,
    Can someone share the code for getting the reference count using QSharedPointer?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 20 Feb 2017, 06:46 last edited by mrjj
      #2

      Hi
      There is no code to share as its not part of the public interface.
      The link talks about subclassing QSharedPointer to make the info
      available.

      Can I ask why you need this info ?

      Maybe something like
      http://doc.qt.io/qt-5/qshareddata.html#details
      http://doc.qt.io/qt-5/qshareddatapointer.html
      is better suited?

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nishant Sharma
        wrote on 20 Feb 2017, 06:50 last edited by
        #3

        Hi,
        Thanks for your reply.
        The reason I ask this is that std::shared_ptr has a API for getting the reference count..
        And, for the purpose of understanding also, we need to know when the reference count was decreased, what made it decrease etc...

        M 1 Reply Last reply 20 Feb 2017, 06:57
        0
        • N Nishant Sharma
          20 Feb 2017, 06:50

          Hi,
          Thanks for your reply.
          The reason I ask this is that std::shared_ptr has a API for getting the reference count..
          And, for the purpose of understanding also, we need to know when the reference count was decreased, what made it decrease etc...

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 20 Feb 2017, 06:57 last edited by
          #4

          @Nishant-Sharma
          Well if feel for it, you can add such info to the class yourself, maybe with extra debug information.
          or simply use std::shared_ptr

          Give it a day or two. I think other might have good idea regarding this :)

          1 Reply Last reply
          0

          2/4

          20 Feb 2017, 06:46

          • Login

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