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 @@ -641,6 +641,31 @@ constexpr auto is( X const& x ) -> bool {
641
641
return false ;
642
642
}
643
643
644
+ template <typename F, typename Capture = std::monostate>
645
+ requires (
646
+ requires { &F::operator (); }
647
+ )
648
+ struct lambda_wrapper {
649
+ F f;
650
+ Capture capture;
651
+
652
+ constexpr lambda_wrapper (F f, Capture capture = {})
653
+ : f{f}, capture{capture} {}
654
+
655
+ template <typename X>
656
+ auto operator ()(X&& x) const {
657
+ if constexpr (std::is_same_v<Capture, std::monostate>)
658
+ return f (std::forward<X>(x));
659
+ else
660
+ return f (std::forward<X>(x), capture);
661
+ }
662
+ };
663
+
664
+ template < lambda_wrapper value, typename X >
665
+ constexpr auto is ( X const & x ) -> bool {
666
+ return value (x);
667
+ }
668
+
644
669
// -------------------------------------------------------------------------------------------------------------
645
670
// Built-in as (partial)
646
671
//
You can’t perform that action at this time.
0 commit comments