Can somebody explain this code and the related concept of variable length list of template parameter

1 week ago 9
ARTICLE AD BOX

Template Parameter Pack Example

template <typename... Types> auto maketuple(Types&&... args){ return std::tuple<Types...>(std::forward<Types>(args)...); } int main(){ auto myTuple=maketuple(1,2,3,4,5); }

I was starting out to learn modern cpp. Can somebody explain what does this code do? Here is the related text :-

C++17 introduced a new syntax for handling variable-length lists of template parameters. This can be used to create a tuple with a variable number of elements.

Read Entire Article