When adding and removing references, call the addRef and removeRef functions. Consider using ICountedPointerTo, which is a smart pointer that handles reference counting automatically, if you want addRef and removeRef called implicitly.
An object is deleted when its reference count reaches zero. All IMRefCounted functions are thread safe.
When converting your code to use IMRefCounted, consider that its behavior differs from that of the deprecated IRefCounted class.
Use these constructors and destructor to create and destroy new objects with reference counters set to zero. T
![]() |
protected:
virtual ~IMRefCounted()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
IMRefCounted(const IMRefCounted&)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
IMRefCounted()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
IMRefCounted& operator =(const IMRefCounted&)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these functions to manage the reference count on the object.
![]() |
public:
void addRef()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
void removeRef()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these functions to access information about the reference count of the object.
![]() |
public:
unsigned long count() const
Windows | OS/2 | AIX |
Yes | Yes | Yes |