I would like to construct a type which is a tuple of same class with different template argument types. I mean:
Imagine we have a class
template<class Arg>
class A
{
//.... details
}
I want to define something like:
template<class... Args>
struct construct_tuple
{
//assume I can access Args[...]
using type = std::tuple<A<Args[0]>, A<Args[1]>, ..., A<Args[n]>>;
}
Could you please help?
I believe there might be a solution by iterating over the variadic arguments and using conctenation between tuple types or maybe using some other TMP e.g. std::enable_if
or std::conditional_t
.
While your code doesn't try to construct anything, this will compile and provide what you want.
template<class... Args>
struct construct_tuple
{
//assume I can access Args[...]
using type = std::tuple<A<Args>...>;
};