std::weak_ptr::use_count

long use_count() const;
(since C++11)

Returns the number of shared_ptr instances that share ownership of the managed object, or ​0​ if the managed object has already been deleted, i.e. *this is empty.

Parameters

(none).

Return value

The number of shared_ptr instances sharing the ownership of the managed object.

Exceptions

noexcept specification:
noexcept

Notes

expired() may be faster than use_count().

Example

See also

checks whether the referenced object was already deleted
(public member function)
doc_CPP
2016-10-11 10:08:31
Comments
Leave a Comment

Please login to continue.