std::shared_ptr::use_count

From Cppreference

Jump to: navigation, search
long use_count() const;

Returns the number of different shared_ptr instances (this included) managing the current object. If there is no managed object, 0 is returned.

Contents

[edit] Parameters

(none)

[edit] Return value

the number of shared_ptr instances managing the current object or 0 if there is no managed object.

[edit] Example

[edit] See also

unique
checks whether the managed object is managed only by the current shared_ptr instance
(public member function)