Documentation Home >> Headers >> <jss/experimental_atomic.hpp> Header >> std::experimental::shared_ptr >> std::experimental::shared_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

Header

#include <experimental/atomic>

See Also