[util.smartptr.weak.obs] (original) (raw)

20 General utilities library [utilities]

20.11 Smart pointers [smartptr]

20.11.4 Class template weak_­ptr [util.smartptr.weak]

20.11.4.5 Observers [util.smartptr.weak.obs]

long use_count() const noexcept;

Returns: 0 if *this is empty; otherwise, the number of shared_­ptr instances that share ownership with *this.

bool expired() const noexcept;

Returns: use_­count() == 0.

shared_ptr<T> lock() const noexcept;

Returns: expired() ? shared_­ptr<T>() : shared_­ptr<T>(*this), executed atomically.

template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept;template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept;

Returns:An unspecified value such that