66<section ><sref ref =" [optional.ref.observe]" /></section >
77<submitter >Jiang An</submitter >
88<date >25 Jul 2025</date >
9- <priority >99 </priority >
9+ <priority >1 </priority >
1010
1111<discussion >
1212<p >
@@ -17,9 +17,18 @@ is still ill-formed, because the return type of its `value_or` member function i
1717However, we don't exclude such <tt >T& </tt > from valid contained types. Given only `value_or` is
1818problematic here, perhaps we can avoid providing it if `T` is not returnable.
1919</p >
20- </discussion >
2120
22- <resolution >
21+ <note >2025-10-16; Reflector poll</note >
22+ <p >
23+ Set priority to 1 after reflector poll.
24+ </p >
25+ <p >
26+ Why not just add <i >Constraints</i >: and use <code >decay_t< T> </code >
27+ for the return type, instead of "not always present" which is currently
28+ only used for member types, not member functions.
29+ </p >
30+
31+ <superseded >
2332<p >
2433This wording is relative to <paper num =" N5014" />.
2534</p >
@@ -68,6 +77,66 @@ return has_value() ? *<i>val</i> : static_cast<X>(std::forward<U>(u)
6877</blockquote >
6978</li >
7079</ol >
80+ </superseded >
81+
82+ <note >2025-10-16; Jonathan provides new wording</note >
83+
84+ </discussion >
85+
86+ <resolution >
87+
88+ <p >
89+ This wording is relative to <paper num =" N5014" />.
90+ </p >
91+
92+ <ol >
93+
94+ <li ><p >Modify <sref ref =" [optional.optional.ref.general]" />, header <tt >< iterator> </tt > synopsis, as indicated:</p >
95+
96+ <blockquote >
97+ <pre >
98+ namespace std {
99+ template< class T>
100+ class optional< T&> {
101+ [… ]
102+ constexpr T& value() const; // freestanding-deleted
103+ template< class U = remove_cv_t< T>>
104+ constexpr <ins >decay_t</ins ><del >remove_cv_t</del >< T> value_or(U&& u) const;
105+ [… ]
106+ };
107+ }
108+ </pre >
109+ </blockquote >
110+ </li >
111+
112+ <li ><p >Modify <sref ref =" [optional.ref.observe]" /> as indicated:</p >
113+
114+ <blockquote >
115+ <pre >
116+ template< class U = remove_cv_t< T>> constexpr <ins >decay_t</ins ><del >remove_cv_t</del >< T> value_or(U&& u) const;
117+ </pre >
118+ <blockquote >
119+ <p >
120+ <ins >
121+ -?- <i >Constraints</i >:
122+ `T` is a non-array object type.
123+ </ins >
124+ </p >
125+ <p >
126+ -8- Let `X` be <tt >remove_cv_t< T> </tt >.
127+ <p />
128+ -9- <i >Mandates</i >: <tt >is_constructible_v< X, T&> && is_convertible_v< U, X> </tt > is `true`.
129+ <p />
130+ -10- <i >Effects</i >: Equivalent to:
131+ </p >
132+ <blockquote ><pre >
133+ return has_value() ? *<i >val</i > : static_cast< X> (std::forward< U> (u));
134+ </pre ></blockquote >
135+ </blockquote >
136+ </blockquote >
137+ </li >
138+ </ol >
139+
71140</resolution >
72141
73142</issue >
0 commit comments