Skip to content

Commit 0673556

Browse files
committed
Cleanup comments about NeverValueField and Option
1 parent d13fe65 commit 0673556

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

subspace/option/option.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,8 @@ using sus::option::__private::StoragePointer;
8787
/// owns the `T` in that case and it ensures the `Option` and the `T` are both
8888
/// accessed with the same const-ness.
8989
///
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.
10092
template <class T>
10193
class Option final {
10294
// Note that `const T&` is allowed (so we don't `std::remove_reference_t<T>`)
@@ -828,12 +820,6 @@ class Option final {
828820

829821
/// Returns an Option<const T&> from this Option<T>, that either holds #None
830822
/// 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`.
837823
constexpr Option<const std::remove_reference_t<T>&> as_ref() const& noexcept {
838824
if (t_.state() == None)
839825
return Option<const std::remove_reference_t<T>&>::none();
@@ -851,9 +837,6 @@ class Option final {
851837

852838
/// Returns an Option<T&> from this Option<T>, that either holds #None or a
853839
/// 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`.
857840
constexpr Option<T&> as_mut() & noexcept {
858841
if (t_.state() == None)
859842
return Option<T&>::none();

0 commit comments

Comments
 (0)