我有这样的功能:
template <typename ... Types>
void foo(const Types & ... values)
{
// expected that 'values' is sequence like
// '1, customvalue1, 2, customvalue2, 3,...'
}
Run Code Online (Sandbox Code Playgroud)
第二个功能:
template <typename ... Types>
void bar(const Types & ... values)
{
// where 'values' are any variables
// some magic here
foo((int_seq<sizeof...(Types)>, values)...);
}
Run Code Online (Sandbox Code Playgroud)
我想将任何变量序列传递给bar,以便此序列转换为'1,value1,2,value2,3,value3'等序列.因此,每个值都遵循基本序列中的数字.但我不能创建这个"魔术代码"来在这两个状态之间的编译阶段转换序列.