From Jason Turner

[util.smartptr.ownerless]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpj8_69v_g/{from.md → to.md} +12 -14
tmp/tmpj8_69v_g/{from.md → to.md} RENAMED
@@ -6,30 +6,30 @@ of shared and weak pointers.
6
  ``` cpp
7
  namespace std {
8
  template<class T = void> struct owner_less;
9
 
10
  template<class T> struct owner_less<shared_ptr<T>> {
11
- bool operator()(const shared_ptr<T>&, const shared_ptr<T>&) const noexcept;
12
- bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
13
- bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
14
  };
15
 
16
  template<class T> struct owner_less<weak_ptr<T>> {
17
- bool operator()(const weak_ptr<T>&, const weak_ptr<T>&) const noexcept;
18
- bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
19
- bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
20
  };
21
 
22
  template<> struct owner_less<void> {
23
  template<class T, class U>
24
- bool operator()(const shared_ptr<T>&, const shared_ptr<U>&) const noexcept;
25
  template<class T, class U>
26
- bool operator()(const shared_ptr<T>&, const weak_ptr<U>&) const noexcept;
27
  template<class T, class U>
28
- bool operator()(const weak_ptr<T>&, const shared_ptr<U>&) const noexcept;
29
  template<class T, class U>
30
- bool operator()(const weak_ptr<T>&, const weak_ptr<U>&) const noexcept;
31
 
32
  using is_transparent = unspecified;
33
  };
34
  }
35
  ```
@@ -40,12 +40,10 @@ namespace std {
40
 
41
  Note that
42
 
43
  - `operator()` defines a strict weak ordering as defined in 
44
  [[alg.sorting]];
45
- - two `shared_ptr` or `weak_ptr` instances are equivalent under the
46
- equivalence relation defined by `operator()`,
47
- `!operator()(a, b) && !operator()(b, a)`, if and only if they share
48
- ownership or are both empty.
49
 
50
  — *end note*]
51
 
 
6
  ``` cpp
7
  namespace std {
8
  template<class T = void> struct owner_less;
9
 
10
  template<class T> struct owner_less<shared_ptr<T>> {
11
+ constexpr bool operator()(const shared_ptr<T>&, const shared_ptr<T>&) const noexcept;
12
+ constexpr bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
13
+ constexpr bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
14
  };
15
 
16
  template<class T> struct owner_less<weak_ptr<T>> {
17
+ constexpr bool operator()(const weak_ptr<T>&, const weak_ptr<T>&) const noexcept;
18
+ constexpr bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
19
+ constexpr bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
20
  };
21
 
22
  template<> struct owner_less<void> {
23
  template<class T, class U>
24
+ constexpr bool operator()(const shared_ptr<T>&, const shared_ptr<U>&) const noexcept;
25
  template<class T, class U>
26
+ constexpr bool operator()(const shared_ptr<T>&, const weak_ptr<U>&) const noexcept;
27
  template<class T, class U>
28
+ constexpr bool operator()(const weak_ptr<T>&, const shared_ptr<U>&) const noexcept;
29
  template<class T, class U>
30
+ constexpr bool operator()(const weak_ptr<T>&, const weak_ptr<U>&) const noexcept;
31
 
32
  using is_transparent = unspecified;
33
  };
34
  }
35
  ```
 
40
 
41
  Note that
42
 
43
  - `operator()` defines a strict weak ordering as defined in 
44
  [[alg.sorting]];
45
+ - `!operator()(a, b) && !operator()(b, a)` is `true` if and only if
46
+ `a.owner_equal(b)` is `true`.
 
 
47
 
48
  — *end note*]
49