From Jason Turner

[optional.observe]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1sc6a728/{from.md → to.md} +13 -13
tmp/tmp1sc6a728/{from.md → to.md} RENAMED
@@ -3,55 +3,55 @@
3
  ``` cpp
4
  constexpr const T* operator->() const;
5
  constexpr T* operator->();
6
  ```
7
 
8
- *Requires:* `*this` contains a value.
9
 
10
  *Returns:* `val`.
11
 
12
  *Throws:* Nothing.
13
 
14
- *Remarks:* These functions shall be constexpr functions.
15
 
16
  ``` cpp
17
  constexpr const T& operator*() const&;
18
  constexpr T& operator*() &;
19
  ```
20
 
21
- *Requires:* `*this` contains a value.
22
 
23
  *Returns:* `*val`.
24
 
25
  *Throws:* Nothing.
26
 
27
- *Remarks:* These functions shall be constexpr functions.
28
 
29
  ``` cpp
30
  constexpr T&& operator*() &&;
31
  constexpr const T&& operator*() const&&;
32
  ```
33
 
34
- *Requires:* `*this` contains a value.
35
 
36
  *Effects:* Equivalent to: `return std::move(*val);`
37
 
38
  ``` cpp
39
  constexpr explicit operator bool() const noexcept;
40
  ```
41
 
42
  *Returns:* `true` if and only if `*this` contains a value.
43
 
44
- *Remarks:* This function shall be a constexpr function.
45
 
46
  ``` cpp
47
  constexpr bool has_value() const noexcept;
48
  ```
49
 
50
  *Returns:* `true` if and only if `*this` contains a value.
51
 
52
- *Remarks:* This function shall be a constexpr function.
53
 
54
  ``` cpp
55
  constexpr const T& value() const&;
56
  constexpr T& value() &;
57
  ```
@@ -75,27 +75,27 @@ return bool(*this) ? std::move(*val) : throw bad_optional_access();
75
 
76
  ``` cpp
77
  template<class U> constexpr T value_or(U&& v) const&;
78
  ```
79
 
 
 
 
80
  *Effects:* Equivalent to:
81
 
82
  ``` cpp
83
  return bool(*this) ? **this : static_cast<T>(std::forward<U>(v));
84
  ```
85
 
86
- *Remarks:* If `is_copy_constructible_v<T> && is_convertible_v<U&&, T>`
87
- is `false`, the program is ill-formed.
88
-
89
  ``` cpp
90
  template<class U> constexpr T value_or(U&& v) &&;
91
  ```
92
 
 
 
 
93
  *Effects:* Equivalent to:
94
 
95
  ``` cpp
96
  return bool(*this) ? std::move(**this) : static_cast<T>(std::forward<U>(v));
97
  ```
98
 
99
- *Remarks:* If `is_move_constructible_v<T> && is_convertible_v<U&&, T>`
100
- is `false`, the program is ill-formed.
101
-
 
3
  ``` cpp
4
  constexpr const T* operator->() const;
5
  constexpr T* operator->();
6
  ```
7
 
8
+ *Preconditions:* `*this` contains a value.
9
 
10
  *Returns:* `val`.
11
 
12
  *Throws:* Nothing.
13
 
14
+ *Remarks:* These functions are constexpr functions.
15
 
16
  ``` cpp
17
  constexpr const T& operator*() const&;
18
  constexpr T& operator*() &;
19
  ```
20
 
21
+ *Preconditions:* `*this` contains a value.
22
 
23
  *Returns:* `*val`.
24
 
25
  *Throws:* Nothing.
26
 
27
+ *Remarks:* These functions are constexpr functions.
28
 
29
  ``` cpp
30
  constexpr T&& operator*() &&;
31
  constexpr const T&& operator*() const&&;
32
  ```
33
 
34
+ *Preconditions:* `*this` contains a value.
35
 
36
  *Effects:* Equivalent to: `return std::move(*val);`
37
 
38
  ``` cpp
39
  constexpr explicit operator bool() const noexcept;
40
  ```
41
 
42
  *Returns:* `true` if and only if `*this` contains a value.
43
 
44
+ *Remarks:* This function is a constexpr function.
45
 
46
  ``` cpp
47
  constexpr bool has_value() const noexcept;
48
  ```
49
 
50
  *Returns:* `true` if and only if `*this` contains a value.
51
 
52
+ *Remarks:* This function is a constexpr function.
53
 
54
  ``` cpp
55
  constexpr const T& value() const&;
56
  constexpr T& value() &;
57
  ```
 
75
 
76
  ``` cpp
77
  template<class U> constexpr T value_or(U&& v) const&;
78
  ```
79
 
80
+ *Mandates:* `is_copy_constructible_v<T> && is_convertible_v<U&&, T>` is
81
+ `true`.
82
+
83
  *Effects:* Equivalent to:
84
 
85
  ``` cpp
86
  return bool(*this) ? **this : static_cast<T>(std::forward<U>(v));
87
  ```
88
 
 
 
 
89
  ``` cpp
90
  template<class U> constexpr T value_or(U&& v) &&;
91
  ```
92
 
93
+ *Mandates:* `is_move_constructible_v<T> && is_convertible_v<U&&, T>` is
94
+ `true`.
95
+
96
  *Effects:* Equivalent to:
97
 
98
  ``` cpp
99
  return bool(*this) ? std::move(**this) : static_cast<T>(std::forward<U>(v));
100
  ```
101