File tree Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change 13
13
#define MRDOX_ADT_OPTIONAL_HPP
14
14
15
15
#include < mrdox/Platform.hpp>
16
+ #include < concepts>
16
17
#include < type_traits>
17
18
#include < utility>
18
19
@@ -27,9 +28,11 @@ namespace mrdox {
27
28
struct DefaultEmptyPredicate
28
29
{
29
30
template <class T >
30
- requires
31
- requires (T t) { t.empty (); }
32
31
constexpr bool operator ()(T const & t) const noexcept
32
+ requires requires
33
+ {
34
+ { t.empty () } -> std::convertible_to<bool >;
35
+ }
33
36
{
34
37
return t.empty ();
35
38
}
@@ -73,6 +76,26 @@ class Optional
73
76
return t_ = T (std::forward<Args>(args)...);
74
77
}
75
78
79
+ constexpr value_type& value () & noexcept
80
+ {
81
+ return t_;
82
+ }
83
+
84
+ constexpr const value_type& value () const & noexcept
85
+ {
86
+ return t_;
87
+ }
88
+
89
+ constexpr value_type&& value() && noexcept
90
+ {
91
+ return std::move (t_);
92
+ }
93
+
94
+ constexpr const value_type&& value() const && noexcept
95
+ {
96
+ return std::move (t_);
97
+ }
98
+
76
99
constexpr value_type& operator *() noexcept
77
100
{
78
101
return t_;
@@ -83,6 +106,16 @@ class Optional
83
106
return t_;
84
107
}
85
108
109
+ constexpr value_type* operator ->() noexcept
110
+ {
111
+ return &t_;
112
+ }
113
+
114
+ constexpr value_type const * operator ->() const noexcept
115
+ {
116
+ return &t_;
117
+ }
118
+
86
119
constexpr explicit operator bool () const noexcept
87
120
{
88
121
return has_value ();
You can’t perform that action at this time.
0 commit comments