@@ -87,16 +87,8 @@ using sus::option::__private::StoragePointer;
87
87
// / owns the `T` in that case and it ensures the `Option` and the `T` are both
88
88
// / accessed with the same const-ness.
89
89
// /
90
- // / If a type provides a never-value field (see mem/never_value.h), and is a
91
- // / [standard-layout
92
- // / type](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType), then
93
- // / Option<T> will have the same size as T.
94
- // /
95
- // / However the never-value field places some limitations on what can be
96
- // / constexpr in the Option type. Because it is not possible to query the state
97
- // / of the Option in a constant evaluation context, state-querying methods can
98
- // / not be constexpr, nor any method that branches based on the current state,
99
- // / such as `unwrap_or()`.
90
+ // / If a type `T` satisties `sus::mem::NeverValueField`, then Option<T> will
91
+ // / have the same size as T.
100
92
template <class T >
101
93
class Option final {
102
94
// Note that `const T&` is allowed (so we don't `std::remove_reference_t<T>`)
@@ -828,12 +820,6 @@ class Option final {
828
820
829
821
// / Returns an Option<const T&> from this Option<T>, that either holds #None
830
822
// / or a reference to the value in this Option.
831
- // /
832
- // / When not holding a `sus::mem::NeverValueField` type, the method can be
833
- // / evaluated in a constant expression.
834
- //
835
- // Not constexpr as it needs to read the state of the value which can't be
836
- // done if `T` is `NeverValueField`.
837
823
constexpr Option<const std::remove_reference_t <T>&> as_ref () const & noexcept {
838
824
if (t_.state () == None)
839
825
return Option<const std::remove_reference_t <T>&>::none ();
@@ -851,9 +837,6 @@ class Option final {
851
837
852
838
// / Returns an Option<T&> from this Option<T>, that either holds #None or a
853
839
// / reference to the value in this Option.
854
- //
855
- // Not constexpr as it needs to read the state of the value which can't be
856
- // done if `T` is `NeverValueField`.
857
840
constexpr Option<T&> as_mut () & noexcept {
858
841
if (t_.state () == None)
859
842
return Option<T&>::none ();
0 commit comments