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 @@ -804,6 +804,26 @@ template<typename T, typename U>
804
804
constexpr auto is ( std::optional<U> const & x ) -> bool
805
805
{ return !x.has_value (); }
806
806
807
+ template <auto value, typename T>
808
+ constexpr auto is_impl ( std::optional<T> const & x ) -> bool {
809
+ if ( x.has_value () )
810
+ return cpp2::is<value>(x.value ());
811
+ else
812
+ return false ;
813
+ }
814
+
815
+ template <auto value, typename T>
816
+ constexpr auto is ( std::optional<T> const & x ) -> bool
817
+ { return cpp2::is_impl<value>(x); }
818
+
819
+ template <cstring_wrapper value, typename T>
820
+ constexpr auto is ( std::optional<T> const & x ) -> bool
821
+ { return cpp2::is_impl<value>(x); }
822
+
823
+ template <double_wrapper value, typename T>
824
+ constexpr auto is ( std::optional<T> const & x ) -> bool
825
+ { return cpp2::is_impl<value>(x); }
826
+
807
827
template <typename T, typename X>
808
828
requires std::is_same_v<X,std::optional<T>>
809
829
constexpr auto as ( X const & x ) -> auto&&
You can’t perform that action at this time.
0 commit comments