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