[util.smartptr.shared.obs] (original) (raw)
20 Memory management library [mem]
20.3 Smart pointers [smartptr]
20.3.2 Shared-ownership pointers [util.sharedptr]
20.3.2.2 Class template shared_ptr [util.smartptr.shared]
20.3.2.2.6 Observers [util.smartptr.shared.obs]
Returns: The stored pointer.
Preconditions: get() != nullptr.
Remarks: When T is an array type or cv void, it is unspecified whether this member function is declared.
If it is declared, it is unspecified what its return type is, except that the declaration (although not necessarily the definition) of the function shall be well-formed.
Preconditions: get() != nullptr.
Remarks: When T is an array type, it is unspecified whether this member function is declared.
If it is declared, it is unspecified what its return type is, except that the declaration (although not necessarily the definition) of the function shall be well-formed.
Preconditions: get() != nullptr && i >= 0.
If T is U[N], i < N.
Remarks: When T is not an array type, it is unspecified whether this member function is declared.
If it is declared, it is unspecified what its return type is, except that the declaration (although not necessarily the definition) of the function shall be well-formed.
Returns: The number of shared_ptr objects, *this included, that share ownership with *this, or 0 when *this is empty.
[Note 1:
get() == nullptrdoes not imply a specific return value of use_count().
— _end note_]
[Note 2:
weak_ptr<T>::lock()can affect the return value of use_count().
— _end note_]
[Note 3:
When multiple threads might affect the return value of use_count(), the result is approximate.
In particular, use_count() == 1 does not imply that accesses through a previously destroyed shared_ptr have in any sense completed.
— _end note_]
Returns: get() != nullptr.
Returns: An unspecified value such that
- owner_before(b) defines a strict weak ordering as defined in [alg.sorting];
- !owner_before(b) && !b.owner_before(*this) is trueif and only if owner_equal(b) is true.
Returns: An unspecified value such that, for any object x where owner_equal(x) is true,owner_hash() == x.owner_hash() is true.
Returns: true if and only if*this and b share ownership or are both empty.
Otherwise returns false.
Remarks: owner_equal is an equivalence relation.