From f803109c757cf89b687a8605e2677470928f296a Mon Sep 17 00:00:00 2001 From: Filip Sajdak Date: Wed, 31 Jan 2024 23:53:46 +0100 Subject: [PATCH 1/5] Refactor built-in is() - part 1 Skipping is() for: variant, any, optional --- include/cpp2util.h | 377 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 309 insertions(+), 68 deletions(-) diff --git a/include/cpp2util.h b/include/cpp2util.h index d8b701318..26bd66860 100644 --- a/include/cpp2util.h +++ b/include/cpp2util.h @@ -320,6 +320,150 @@ using longdouble = long double; using _schar = signed char; // normally use i8 instead using _uchar = unsigned char; // normally use u8 instead +//----------------------------------------------------------------------- +// +// Helper for concepts +// +//----------------------------------------------------------------------- +// + +template +auto argument_of_helper(Ret(*) (Arg)) -> Arg; + +template +auto argument_of_helper(Ret(F::*) (Arg)) -> Arg; + +template +auto argument_of_helper(Ret(F::*) (Arg) const) -> Arg; + +template +auto argument_of_helper(F) -> CPP2_TYPEOF(argument_of_helper(&F::operator())); + +template +using argument_of_t = CPP2_TYPEOF(argument_of_helper(std::declval())); + +template +using pointee_t = std::iter_value_t; + +template +using range_value_t = std::iter_value_t()))>; + +template