Documentation Home >> Headers >> <jss/experimental_atomic.hpp> Header >> std::experimental::weak_ptr >> std::experimental::weak_ptr::use_count member function

The use_count member function returns the number of std::experimental::shared_ptr instances and std::experimental::atomic_shared_ptr instances sharing ownership with *this. It is an instantaneous snapshot, and in multithreaded systems the value may vary between consecutive calls due to the actions of other threads.

long use_count() const noexcept;

Returns:

The number of std::experimental::shared_ptr and std::experimental::atomic_shared_ptr instances sharing ownership with *this at the point of the call.

Throws:

Nothing

Note:

std::experimental::weak_ptr instances do not count towards the value returned by use_count().

Header

#include <experimental/atomic>

See Also