Namespaces
Variants
Views
Actions

std::weak_ptr::expired

From cppreference.com
 
 
 
 
 
bool expired() const;
(since C++11)

Checks whether the managed object has already been deleted. Equivalent to use_count() == 0.

Contents

[edit] Parameters

(none)

[edit] Return value

true if the managed object has already been deleted, false otherwise.

[edit] Exceptions

noexcept specification:  
noexcept
  (since C++11)

[edit] Notes

expired() may be faster than use_count().

[edit] Example

[edit] See also

creates a shared_ptr that manages the referenced object
(public member function) [edit]
returns the number of shared_ptr objects that manage the object
(public member function) [edit]