I want realize code like this:
template <typename... Args>
class A
{
public:
A(Args... args) {ind = std::make_tuple(args...);}
std::tuple<Args...> ind;
};
void foo()
{
std::cout << std::endl;
}
template <typename First, typename... Rest>
void foo(First _first, Rest... _rest)
{
std::cout << _first;
foo(_rest...);
}
int main()
{
A<int, int> a1(1, 2);
A<int, int, int> a2(1, 2, 3);
A<int, int, int, int> a3(1, 2, 3, 4);
foo(a1.ind);
foo(a2.ind);
foo(a3.ind);
}
In Class A the field ind does not have to be tuple, the main thing is that the function is passed pack of parameters.
Aucun commentaire:
Enregistrer un commentaire