【发布时间】:2018-04-25 11:59:23
【问题描述】:
在这里,我想重写一个可变参数模板参数包并将某些类型的出现替换为另一种类型。这是一个类似伪代码的示例:
#include <string>
template <typename Params, typename Args>
struct TermRewrite {
template <typename... Body>
static auto constexpr eval(){
// Fill here...
}
};
int main() {
TermRewrite<int, char>::eval<int, std::string, double>();
// should give me pack of types as <char, std::string, double>
// ie. it should replace type int with char in Body...
}
这样我就可以将这些术语重写链接到最后。基本上,我想在转发之前转换可变参数模板。我怎样才能做到这一点?我无法提出解决方案。对于所有你想知道的,这是我自己编造的练习。另外,您对可用性有什么建议,以便更轻松地链接TermRewrite 调用?
【问题讨论】: