File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -843,6 +843,26 @@ template<typename T, typename U>
843
843
constexpr auto is ( std::optional<U> const & x ) -> bool
844
844
{ return !x.has_value (); }
845
845
846
+ template <auto value, typename T>
847
+ constexpr auto is_impl ( std::optional<T> const & x ) -> bool {
848
+ if ( x.has_value () )
849
+ return cpp2::is<value>(x.value ());
850
+ else
851
+ return false ;
852
+ }
853
+
854
+ template <auto value, typename T>
855
+ constexpr auto is ( std::optional<T> const & x ) -> bool
856
+ { return cpp2::is_impl<value>(x); }
857
+
858
+ template <cstring_wrapper value, typename T>
859
+ constexpr auto is ( std::optional<T> const & x ) -> bool
860
+ { return cpp2::is_impl<value>(x); }
861
+
862
+ template <double_wrapper value, typename T>
863
+ constexpr auto is ( std::optional<T> const & x ) -> bool
864
+ { return cpp2::is_impl<value>(x); }
865
+
846
866
template <typename T, typename X>
847
867
requires std::is_same_v<X,std::optional<T>>
848
868
constexpr auto as ( X const & x ) -> auto&&
You can’t perform that action at this time.
0 commit comments