template<unsigned N, typename ...Types> struct get_nth_type;
template<unsigned N, typename Head, typename ...Tail>
struct get_nth_type<N, Head, Tail...> : get_nth_type<N-1, Tail...> { };
template<typename Head, typename ...Tail>
struct get_nth_type<0, Head, Tail...> {
typedef Head type;
};
struct no_type {};
template<unsigned N>
struct get_nth_type<N> {
typedef no_type type;
};
template<typename T, typename U> struct pair { };
template<typename T, typename U> pair<T, U> make_pair(T, U);
template<typename ...Args>
typename get_nth_type<0, Args...>::type first_arg(Args...);
template<typename ...Args>
typename get_nth_type<1, Args...>::type second_arg(Args...);
void test_simple_deduction(int *ip, float *fp, double *dp) {
int *ip1 = first_arg(ip);
int *ip2 = first_arg(ip, fp);
int *ip3 = first_arg(ip, fp, dp);
no_type nt1 = first_arg();
}
template<typename ...Args>
typename get_nth_type<0, Args...>::type first_arg_ref(Args&...);
template<typename ...Args>
typename get_nth_type<1, Args...>::type second_arg_ref(Args&...);
void test_simple_ref_deduction(int *ip, float *fp, double *dp) {
int *ip1 = first_arg_ref(ip);
int *ip2 = first_arg_ref(ip, fp);
int *ip3 = first_arg_ref(ip, fp, dp);
no_type nt1 = first_arg_ref();
}
template<typename ...Args1, typename ...Args2>
typename get_nth_type<0, Args1...>::type first_arg_pair(pair<Args1, Args2>...);
template<typename ...Args1, typename ...Args2>
typename get_nth_type<1, Args1...>::type second_arg_pair(pair<Args1, Args2>...);
void test_pair_deduction(int *ip, float *fp, double *dp) {
int *ip1 = first_arg_pair(make_pair(ip, 17));
int *ip2 = first_arg_pair(make_pair(ip, 17), make_pair(fp, 17));
int *ip3 = first_arg_pair(make_pair(ip, 17), make_pair(fp, 17),
make_pair(dp, 17));
float *fp1 = second_arg_pair(make_pair(ip, 17), make_pair(fp, 17));
float *fp2 = second_arg_pair(make_pair(ip, 17), make_pair(fp, 17),
make_pair(dp, 17));
no_type nt1 = first_arg_pair();
no_type nt2 = second_arg_pair();
no_type nt3 = second_arg_pair(make_pair(ip, 17));
first_arg_pair(make_pair(ip, 17), 16); }
template<typename ...Types> struct tuple { };
template<typename ...Types>
void pack_not_at_end(tuple<Types...>, Types... values, int);
void test_pack_not_at_end(tuple<int*, double*> t2) {
pack_not_at_end(t2, 0, 0, 0); pack_not_at_end<int*, double*>(t2, 0, 0, 0); }