From Jason Turner

[optional.observe]

Diff to HTML by rtfpessoa

tmp/tmpoqpuwsxy/{from.md → to.md} RENAMED
@@ -3,33 +3,33 @@
3
  ``` cpp
4
  constexpr const T* operator->() const noexcept;
5
  constexpr T* operator->() noexcept;
6
  ```
7
 
8
- *Preconditions:* `*this` contains a value.
9
 
10
  *Returns:* `val`.
11
 
12
  *Remarks:* These functions are constexpr functions.
13
 
14
  ``` cpp
15
  constexpr const T& operator*() const & noexcept;
16
  constexpr T& operator*() & noexcept;
17
  ```
18
 
19
- *Preconditions:* `*this` contains a value.
20
 
21
  *Returns:* `*val`.
22
 
23
  *Remarks:* These functions are constexpr functions.
24
 
25
  ``` cpp
26
  constexpr T&& operator*() && noexcept;
27
  constexpr const T&& operator*() const && noexcept;
28
  ```
29
 
30
- *Preconditions:* `*this` contains a value.
31
 
32
  *Effects:* Equivalent to: `return std::move(*val);`
33
 
34
  ``` cpp
35
  constexpr explicit operator bool() const noexcept;
@@ -68,11 +68,11 @@ constexpr const T&& value() const &&;
68
  ``` cpp
69
  return has_value() ? std::move(*val) : throw bad_optional_access();
70
  ```
71
 
72
  ``` cpp
73
- template<class U> constexpr T value_or(U&& v) const &;
74
  ```
75
 
76
  *Mandates:* `is_copy_constructible_v<T> && is_convertible_v<U&&, T>` is
77
  `true`.
78
 
@@ -81,11 +81,11 @@ template<class U> constexpr T value_or(U&& v) const &;
81
  ``` cpp
82
  return has_value() ? **this : static_cast<T>(std::forward<U>(v));
83
  ```
84
 
85
  ``` cpp
86
- template<class U> constexpr T value_or(U&& v) &&;
87
  ```
88
 
89
  *Mandates:* `is_move_constructible_v<T> && is_convertible_v<U&&, T>` is
90
  `true`.
91
 
 
3
  ``` cpp
4
  constexpr const T* operator->() const noexcept;
5
  constexpr T* operator->() noexcept;
6
  ```
7
 
8
+ `has_value()` is `true`.
9
 
10
  *Returns:* `val`.
11
 
12
  *Remarks:* These functions are constexpr functions.
13
 
14
  ``` cpp
15
  constexpr const T& operator*() const & noexcept;
16
  constexpr T& operator*() & noexcept;
17
  ```
18
 
19
+ `has_value()` is `true`.
20
 
21
  *Returns:* `*val`.
22
 
23
  *Remarks:* These functions are constexpr functions.
24
 
25
  ``` cpp
26
  constexpr T&& operator*() && noexcept;
27
  constexpr const T&& operator*() const && noexcept;
28
  ```
29
 
30
+ `has_value()` is `true`.
31
 
32
  *Effects:* Equivalent to: `return std::move(*val);`
33
 
34
  ``` cpp
35
  constexpr explicit operator bool() const noexcept;
 
68
  ``` cpp
69
  return has_value() ? std::move(*val) : throw bad_optional_access();
70
  ```
71
 
72
  ``` cpp
73
+ template<class U = remove_cv_t<T>> constexpr T value_or(U&& v) const &;
74
  ```
75
 
76
  *Mandates:* `is_copy_constructible_v<T> && is_convertible_v<U&&, T>` is
77
  `true`.
78
 
 
81
  ``` cpp
82
  return has_value() ? **this : static_cast<T>(std::forward<U>(v));
83
  ```
84
 
85
  ``` cpp
86
+ template<class U = remove_cv_t<T>> constexpr T value_or(U&& v) &&;
87
  ```
88
 
89
  *Mandates:* `is_move_constructible_v<T> && is_convertible_v<U&&, T>` is
90
  `true`.
91