diff --git a/include/cpp2util.h b/include/cpp2util.h index d8b701318a..a46bc77e66 100644 --- a/include/cpp2util.h +++ b/include/cpp2util.h @@ -320,6 +320,155 @@ 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