@@ -1175,20 +1175,20 @@ constexpr auto is( std::monostate const& ) -> std::true_type {
1175
1175
return {};
1176
1176
}
1177
1177
1178
- template <std:: size_t I, typename Ret, typename ... Args >
1179
- auto nth_argument_of_helper (Ret(*) (Args... )) -> std::tuple_element_t<I, std::tuple<Args...>> ;
1178
+ template <typename Ret, typename Arg >
1179
+ auto argument_of_helper (Ret(*) (Arg )) -> Arg ;
1180
1180
1181
- template <std:: size_t I, typename Ret, typename F, typename ... Args >
1182
- auto nth_argument_of_helper (Ret(F::*) (Args... )) -> std::tuple_element_t<I, std::tuple<Args...>> ;
1181
+ template <typename Ret, typename F, typename Arg >
1182
+ auto argument_of_helper (Ret(F::*) (Arg )) -> Arg ;
1183
1183
1184
- template <std:: size_t I, typename Ret, typename F, typename ... Args >
1185
- auto nth_argument_of_helper (Ret(F::*) (Args... ) const ) -> std::tuple_element_t<I, std::tuple<Args...>> ;
1184
+ template <typename Ret, typename F, typename Arg >
1185
+ auto argument_of_helper (Ret(F::*) (Arg ) const ) -> Arg ;
1186
1186
1187
- template <std:: size_t I, typename F>
1188
- auto nth_argument_of_helper (F) -> CPP2_TYPEOF(nth_argument_of_helper<I> (&F::operator ()));
1187
+ template <typename F>
1188
+ auto argument_of_helper (F) -> CPP2_TYPEOF(argument_of_helper (&F::operator ()));
1189
1189
1190
- template <std:: size_t I, typename T>
1191
- using nth_argument_of = CPP2_TYPEOF(nth_argument_of_helper<I> (std::declval<T>()));
1190
+ template <typename T>
1191
+ using argument_of = CPP2_TYPEOF(argument_of_helper (std::declval<T>()));
1192
1192
1193
1193
// Values
1194
1194
//
@@ -1206,9 +1206,9 @@ inline constexpr auto is( auto const& x, auto const& value ) -> bool
1206
1206
// Predicate case
1207
1207
else if constexpr ( requires { {value (x)} -> boolean_testable; } ) {
1208
1208
// defined argument type
1209
- if constexpr (requires { std::declval<nth_argument_of< 0 , CPP2_TYPEOF (value)>>(); }){
1209
+ if constexpr (requires { std::declval<argument_of< CPP2_TYPEOF (value)>>(); }){
1210
1210
// valid coversion of x to argument type
1211
- if constexpr ( requires { nth_argument_of< 0 , CPP2_TYPEOF (value)>{x}; }) {
1211
+ if constexpr ( requires { argument_of< CPP2_TYPEOF (value)>{x}; }) {
1212
1212
return value (x); // function-like with valid coversion of argument
1213
1213
}
1214
1214
return false ; // function-like with invalid coversion of argument
@@ -1513,10 +1513,10 @@ constexpr auto is( std::optional<T> const& x, auto const& value ) -> bool
1513
1513
// Predicate case
1514
1514
if constexpr ( requires { {value (x)} -> boolean_testable; } ) {
1515
1515
// defined argument type
1516
- if constexpr (requires { std::declval<nth_argument_of< 0 , CPP2_TYPEOF (value)>>(); }){
1516
+ if constexpr (requires { std::declval<argument_of< CPP2_TYPEOF (value)>>(); }){
1517
1517
// argument type is optional
1518
- if constexpr (requires {is<std::optional>(std::declval<nth_argument_of< 0 , CPP2_TYPEOF (value)>>());}) {
1519
- using value_type = typename nth_argument_of< 0 , CPP2_TYPEOF (value)>::value_type; // workaround for gcc-10
1518
+ if constexpr (requires {is<std::optional>(std::declval<argument_of< CPP2_TYPEOF (value)>>());}) {
1519
+ using value_type = typename argument_of< CPP2_TYPEOF (value)>::value_type; // workaround for gcc-10
1520
1520
// valid conversion of x::value_type to argument value_type
1521
1521
if constexpr ( requires { value_type{std::declval<T>()}; }) {
1522
1522
return value (x); // function-like with valid conversion of argument
0 commit comments