File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -686,6 +686,31 @@ constexpr auto is( X const& x ) -> bool {
686
686
return false ;
687
687
}
688
688
689
+ template <typename F, typename Capture = std::monostate>
690
+ requires (
691
+ requires { &F::operator (); }
692
+ )
693
+ struct lambda_wrapper {
694
+ F f;
695
+ Capture capture;
696
+
697
+ constexpr lambda_wrapper (F f, Capture capture = {})
698
+ : f{f}, capture{capture} {}
699
+
700
+ template <typename X>
701
+ auto operator ()(X&& x) const {
702
+ if constexpr (std::is_same_v<Capture, std::monostate>)
703
+ return f (std::forward<X>(x));
704
+ else
705
+ return f (std::forward<X>(x), capture);
706
+ }
707
+ };
708
+
709
+ template < lambda_wrapper value, typename X >
710
+ constexpr auto is ( X const & x ) -> bool {
711
+ return value (x);
712
+ }
713
+
689
714
// -------------------------------------------------------------------------------------------------------------
690
715
// Built-in as (partial)
691
716
//
You can’t perform that action at this time.
0 commit comments