public member function


long int use_count() const noexcept;
Use count
Returns the number of shared_ptr objects that share ownership over the same pointer as this object.

Notice that weak_ptr objects in the owning group are not counted.

If this is an empty weak_ptr, the function returns zero.

Library implementations are not required to keep a count of any particular set of owners, and thus it may not be efficient to call this function. To check specifically whether use_count is 0, you can use member expired instead, which may be faster.



Return value

The number of objects sharing ownership over the same pointer as this.

See also