编译器告诉我我不扩展参数包吗?

时间:2019-04-30 16:30:39

标签: c++ templates c++17 variadic-templates

此简单的可变参数模板函数出现编译器错误:

错误C3520:“ StringType”:必须在这种情况下扩展参数包

错误消息很清楚,但出乎意料。

template<class... StringType>
void CopySomethingOrOther(const std::wstring& destination, const StringType& ... files)
{
    if constexpr (sizeof...(files))
        (CopyAcrossFile(files, destination), ...);
}

此函数采用目标字符串和各种路径的文件路径,并将每个文件复制到目标目录。该错误指向函数头的行,但是我不确定这是否有意义。

0 个答案:

没有答案
相关问题