Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在阅读 Modern C++ Design 并且想到 typelist 构造可以被可变参数模板替换。两者似乎都依赖递归来分别处理列表中的第一个类型和列表的其余部分。有没有什么类型列表允许你做一个可变参数模板不能做的事情?
类型列表允许您做一些事情。例如,您不能将可变参数包作为元函数的结果——没有办法表达这样的事情:
template <typename... Args> struct argpack_id { typedef Args result; };
您可以使用类型列表来做到这一点。
另一方面,您可能应该将类型列表本身实现为
template <typename... Args> struct TypeList {};