File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -637,6 +637,28 @@ auto is( X const& x ) -> bool {
637
637
return false ;
638
638
}
639
639
640
+ template <typename F, typename Capture = std::monostate>
641
+ struct lambda_wrapper {
642
+ F f;
643
+ Capture capture;
644
+
645
+ constexpr lambda_wrapper (F f, Capture capture = {})
646
+ : f{f}, capture{capture} {}
647
+
648
+ template <typename X>
649
+ auto operator ()(X&& x) const {
650
+ if constexpr (std::is_same_v<Capture, std::monostate>)
651
+ return f (std::forward<X>(x));
652
+ else
653
+ return f (std::forward<X>(x), capture);
654
+ }
655
+ };
656
+
657
+ template < lambda_wrapper value, typename X >
658
+ auto is ( X const & x ) -> bool {
659
+ return value (x);
660
+ }
661
+
640
662
// -------------------------------------------------------------------------------------------------------------
641
663
// Built-in as (partial)
642
664
//
You can’t perform that action at this time.
0 commit comments