您可以看到此函数声明有什么问题吗?
template<typename... Containers>
std::tuple<typename Containers::value_type...>
foo(const Containers &...args);
当我尝试调用它时,如下所示:
foo(std::list<int>(), std::vector<float>());
MSVC2013说error C2027: use of undefined type 'std::tuple<Containers::value_type>
。
我尝试使用“ late return”语法重写函数声明,但没有区别。
有什么办法可以实现此代码要执行的操作?
您有权填写Microsoft Connect上的错误报告…在clang和gcc上的代码正常。
VS2013以及gcc 4.7上的解决方法:
template <typename T>
using ValueType = typename T::value_type;
template<typename... Containers>
std::tuple<ValueType<Containers>...>
foo( const Containers &...args ) { return {}; }
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句