How to create an alias std :: tuple?

I am learning C ++ and I would like to know how to create an alias for std::tuple.

I want to do what you can do with std::tuple, but using a different name. Is it possible?

Thank.

+4
source share
2 answers
template <typename... Args>
using my_tuple = std::tuple<Args...>;

Live demo link.

+5
source

You can do this with a template alias

template< class... tupleArgs > using newname = std::tuple< tupleArgs... >;

int main()
{
   newname<int, std::string, double> t1;
   return 0;
}

Simple demonstration

+4
source

All Articles