Overview
Features
Download
Documentation
Community
Add-Ons & Services

How to get the SharedPtr::_pCounter ?

A general discussion forum.

How to get the SharedPtr::_pCounter ?

Postby lazalong » 26 Sep 2008, 08:05

Hello,

I would like to get the _pCounter of a SharedPtr.
Can you add something like:

unsigned int const SharedPtr::getCount() const

I need this because I have a list of SharedPtr Resource*.
And I want to release only the oldest unused one first.

So if getCount() == 1 this means that only the list is still referencing the ptr
and I can remove it from the list to perform some resource shutdown stuff.

I could have an inUse bool but it would be easier to check if no one is using the resource.

If this feature doesn't exist it would be great to add it to 1.3.3 :)

Thanks,
Steven



lazalong
 
Posts: 16
Joined: 15 Feb 2008, 08:36
Location: Australia

Re: How to get the SharedPtr::_pCounter ?

Postby guenter » 26 Sep 2008, 13:43

I have added this to 1.3.3. The method is called referenceCount() to be consistent with RefCountedObject.
guenter
 
Posts: 1165
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest