Ang*_*iel 8 c++ clang variadic-templates c++14
我遇到的问题是来自clang(c ++ 14)的以下警告:
包扩展包含参数包'v_seconds',它与外部参数包具有不同的长度(3对1)
以下示例代码中遇到此问题:
template<typename... v_firsts>
struct types_list {
template<typename... v_seconds>
using pairs_list = types_list<std::pair<v_firsts, v_seconds>...>;
};
using my_types_list = types_list<short, int, long>;
using my_pairs_list = my_types_list::pairs_list<short, int, long>; // GOOD
template<typename... v_pack>
using any_pairs_list = my_types_list::pairs_list<v_pack...>; // BAD
Run Code Online (Sandbox Code Playgroud)
我怎么解释错误是一个莫名其妙的专业化any_pairs_list,其中v_seconds有1的长度遇到,然后遇到自然错误.
但是上面的代码是整个示例代码 - 我从不使用专门化的代码any_pairs_list.
所以,我必须得出结论,然而仍然创造了专业化......
现在,通常的TMP分叉问题:
if (This an intentional behavior of the variadic syntax) {
Can someone reference some documentation so that I can learn more?
} else if (This a known clang decision or problem) {
Can someone reference some discussion?
} else {
Can someone please name the issue / mistake?
}
Run Code Online (Sandbox Code Playgroud)
PS我已经使用Apple安装的Clang(v8.1.0)以及Visual Studio 2017 Clang扩展进行了测试.不幸的是我没有linux环境来测试......