Namespaces
Variants
Views
Actions

std::weak_ptr::use_count

From cppreference.com
< cpp‎ | memory‎ | weak ptr
Revision as of 23:49, 21 January 2013 by 81.223.29.242 (Talk)

 
 
 
 
 
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.

Contents

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 Template:rlpf.

Example

See also

Template:cpp/memory/weak ptr/dcl list expired