From Jason Turner

[inout.ptr.t]

Diff to HTML by rtfpessoa

tmp/tmpq4fp2khx/{from.md → to.md} RENAMED
@@ -38,16 +38,16 @@ place.
38
  ``` cpp
39
  namespace std {
40
  template<class Smart, class Pointer, class... Args>
41
  class inout_ptr_t {
42
  public:
43
- explicit inout_ptr_t(Smart&, Args...);
44
  inout_ptr_t(const inout_ptr_t&) = delete;
45
 
46
- ~inout_ptr_t();
47
 
48
- operator Pointer*() const noexcept;
49
  operator void**() const noexcept;
50
 
51
  private:
52
  Smart& s; // exposition only
53
  tuple<Args...> a; // exposition only
@@ -69,11 +69,11 @@ template.
69
 
70
  Evaluations of the conversion functions on the same object may conflict
71
  [[intro.races]].
72
 
73
  ``` cpp
74
- explicit inout_ptr_t(Smart& smart, Args... args);
75
  ```
76
 
77
  *Effects:* Initializes `s` with `smart`, `a` with
78
  `std::forward<Args>(args)...`, and `p` to either
79
 
@@ -86,11 +86,11 @@ explicit inout_ptr_t(Smart& smart, Args... args);
86
  non-terminating and safe implementation strategies. For example, an
87
  intrusive pointer implementation with a control block can allocate in
88
  the constructor and safely fail with an exception. — *end note*]
89
 
90
  ``` cpp
91
- ~inout_ptr_t();
92
  ```
93
 
94
  Let `SP` be *`POINTER_OF_OR`*`(Smart, Pointer)` [[memory.general]].
95
 
96
  Let *release-statement* be `s.release();` if an implementation does not
@@ -98,14 +98,12 @@ call `s.release()` in the constructor. Otherwise, it is empty.
98
 
99
  *Effects:* Equivalent to:
100
 
101
  -
102
  ``` cpp
103
- if (p) {
104
  apply([&](auto&&... args) {
105
  s = Smart(static_cast<SP>(p), std::forward<Args>(args)...); }, std::move(a));
106
- }
107
  ```
108
 
109
  if `is_pointer_v<Smart>` is `true`;
110
  - otherwise,
111
  ``` cpp
@@ -130,11 +128,11 @@ call `s.release()` in the constructor. Otherwise, it is empty.
130
 
131
  if `is_constructible_v<Smart, SP, Args...>` is `true`;
132
  - otherwise, the program is ill-formed.
133
 
134
  ``` cpp
135
- operator Pointer*() const noexcept;
136
  ```
137
 
138
  *Preconditions:* `operator void**()` has not been called on `*this`.
139
 
140
  *Returns:* `addressof(const_cast<Pointer&>(p))`.
 
38
  ``` cpp
39
  namespace std {
40
  template<class Smart, class Pointer, class... Args>
41
  class inout_ptr_t {
42
  public:
43
+ constexpr explicit inout_ptr_t(Smart&, Args...);
44
  inout_ptr_t(const inout_ptr_t&) = delete;
45
 
46
+ constexpr ~inout_ptr_t();
47
 
48
+ constexpr operator Pointer*() const noexcept;
49
  operator void**() const noexcept;
50
 
51
  private:
52
  Smart& s; // exposition only
53
  tuple<Args...> a; // exposition only
 
69
 
70
  Evaluations of the conversion functions on the same object may conflict
71
  [[intro.races]].
72
 
73
  ``` cpp
74
+ constexpr explicit inout_ptr_t(Smart& smart, Args... args);
75
  ```
76
 
77
  *Effects:* Initializes `s` with `smart`, `a` with
78
  `std::forward<Args>(args)...`, and `p` to either
79
 
 
86
  non-terminating and safe implementation strategies. For example, an
87
  intrusive pointer implementation with a control block can allocate in
88
  the constructor and safely fail with an exception. — *end note*]
89
 
90
  ``` cpp
91
+ constexpr ~inout_ptr_t();
92
  ```
93
 
94
  Let `SP` be *`POINTER_OF_OR`*`(Smart, Pointer)` [[memory.general]].
95
 
96
  Let *release-statement* be `s.release();` if an implementation does not
 
98
 
99
  *Effects:* Equivalent to:
100
 
101
  -
102
  ``` cpp
 
103
  apply([&](auto&&... args) {
104
  s = Smart(static_cast<SP>(p), std::forward<Args>(args)...); }, std::move(a));
 
105
  ```
106
 
107
  if `is_pointer_v<Smart>` is `true`;
108
  - otherwise,
109
  ``` cpp
 
128
 
129
  if `is_constructible_v<Smart, SP, Args...>` is `true`;
130
  - otherwise, the program is ill-formed.
131
 
132
  ``` cpp
133
+ constexpr operator Pointer*() const noexcept;
134
  ```
135
 
136
  *Preconditions:* `operator void**()` has not been called on `*this`.
137
 
138
  *Returns:* `addressof(const_cast<Pointer&>(p))`.