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 General and Desktop
3 Posts 2 Posters 3.7k 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.
  • G Offline
    G Offline
    goocreations
    wrote on 22 Oct 2012, 07:16 last edited by
    #1

    Is there any way I can retrieve the reference count for a QSharedPointer? If not what is the best way (if any) to implement a subclass of QSharedPointer that can return the reference count?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on 22 Oct 2012, 07:48 last edited by
      #2

      You could reimplement your own reference counting mechanism around "QAtomicInt":http://qt-project.org/doc/qt-4.8/qatomicint.html.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goocreations
        wrote on 22 Oct 2012, 08:14 last edited by
        #3

        Wow, cool. I was just implmeneting my own atomic int. Didn't know there was a class in Qt.

        So should I inherit from QSharedPointer and in every constructor and copy constructor increase the count; and then decrease the count in the desctructor?

        1 Reply Last reply
        0

        1/3

        22 Oct 2012, 07:16

        • Login

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