Are type lists completely replaced by variable patterns?

I am reading Modern C ++ Design, and it occurred to me that the type constructor could be replaced with variative templates. Both seem to rely on recursion to handle the first type in the list, and the rest of the list separately. Are there any type lists that allow you to do this, no matter what the variation pattern will not be?

+6
source share
1 answer

Lists of letters allow you a few things. For example, you cannot have a package of variational arguments as a result of a metapound - there simply is no way to express something like this:

template <typename... Args> struct argpack_id { typedef Args result; }; 

You can do this with type lists.

On the other hand, you should probably implement the list itself as

 template <typename... Args> struct TypeList {}; 
+8
source

Source: https://habr.com/ru/post/947226/


All Articles