File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -704,6 +704,31 @@ constexpr auto is( X const& x ) -> bool {
704
704
return false ;
705
705
}
706
706
707
+ template <typename F, typename Capture = std::monostate>
708
+ requires (
709
+ requires { &F::operator (); }
710
+ )
711
+ struct lambda_wrapper {
712
+ F f;
713
+ Capture capture;
714
+
715
+ constexpr lambda_wrapper (F f, Capture capture = {})
716
+ : f{f}, capture{capture} {}
717
+
718
+ template <typename X>
719
+ auto operator ()(X&& x) const {
720
+ if constexpr (std::is_same_v<Capture, std::monostate>)
721
+ return f (std::forward<X>(x));
722
+ else
723
+ return f (std::forward<X>(x), capture);
724
+ }
725
+ };
726
+
727
+ template < lambda_wrapper value, typename X >
728
+ constexpr auto is ( X const & x ) -> bool {
729
+ return value (x);
730
+ }
731
+
707
732
// -------------------------------------------------------------------------------------------------------------
708
733
// Built-in as (partial)
709
734
//
You can’t perform that action at this time.
0 commit comments