From Jason Turner

[util.smartptr.weak.obs]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpttim2sag/{from.md → to.md} +27 -10
tmp/tmpttim2sag/{from.md → to.md} RENAMED
@@ -1,36 +1,53 @@
1
  ##### Observers <a id="util.smartptr.weak.obs">[[util.smartptr.weak.obs]]</a>
2
 
3
  ``` cpp
4
- long use_count() const noexcept;
5
  ```
6
 
7
  *Returns:* `0` if `*this` is empty; otherwise, the number of
8
  `shared_ptr` instances that share ownership with `*this`.
9
 
10
  ``` cpp
11
- bool expired() const noexcept;
12
  ```
13
 
14
  *Returns:* `use_count() == 0`.
15
 
16
  ``` cpp
17
- shared_ptr<T> lock() const noexcept;
18
  ```
19
 
20
  *Returns:* `expired() ? shared_ptr<T>() : shared_ptr<T>(*this)`,
21
  executed atomically.
22
 
23
  ``` cpp
24
- template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept;
25
- template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept;
26
  ```
27
 
28
  *Returns:* An unspecified value such that
29
 
30
- - `x.owner_before(y)` defines a strict weak ordering as defined
31
  in  [[alg.sorting]];
32
- - under the equivalence relation defined by `owner_before`,
33
- `!a.owner_before(b) && !b.owner_before(a)`, two `shared_ptr` or
34
- `weak_ptr` instances are equivalent if and only if they share
35
- ownership or are both empty.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
 
1
  ##### Observers <a id="util.smartptr.weak.obs">[[util.smartptr.weak.obs]]</a>
2
 
3
  ``` cpp
4
+ constexpr long use_count() const noexcept;
5
  ```
6
 
7
  *Returns:* `0` if `*this` is empty; otherwise, the number of
8
  `shared_ptr` instances that share ownership with `*this`.
9
 
10
  ``` cpp
11
+ constexpr bool expired() const noexcept;
12
  ```
13
 
14
  *Returns:* `use_count() == 0`.
15
 
16
  ``` cpp
17
+ constexpr shared_ptr<T> lock() const noexcept;
18
  ```
19
 
20
  *Returns:* `expired() ? shared_ptr<T>() : shared_ptr<T>(*this)`,
21
  executed atomically.
22
 
23
  ``` cpp
24
+ template<class U> constexpr bool owner_before(const shared_ptr<U>& b) const noexcept;
25
+ template<class U> constexpr bool owner_before(const weak_ptr<U>& b) const noexcept;
26
  ```
27
 
28
  *Returns:* An unspecified value such that
29
 
30
+ - `owner_before(b)` defines a strict weak ordering as defined
31
  in  [[alg.sorting]];
32
+ - `!owner_before(b) && !b.owner_before(*this)` is `true` if and only if
33
+ `owner_equal(b)` is `true`.
34
+
35
+ ``` cpp
36
+ size_t owner_hash() const noexcept;
37
+ ```
38
+
39
+ *Returns:* An unspecified value such that, for any object `x` where
40
+ `owner_equal(x)` is `true`, `owner_hash() == x.owner_hash()` is `true`.
41
+
42
+ ``` cpp
43
+ template<class U>
44
+ constexpr bool owner_equal(const shared_ptr<U>& b) const noexcept;
45
+ template<class U>
46
+ constexpr bool owner_equal(const weak_ptr<U>& b) const noexcept;
47
+ ```
48
+
49
+ *Returns:* `true` if and only if `*this` and `b` share ownership or are
50
+ both empty. Otherwise returns `false`.
51
+
52
+ *Remarks:* `owner_equal` is an equivalence relation.
53