ral*_*ark 7 c++ templates c++14
这在clang和gcc上编译都没有错误,但在MSVC中失败:( 编译器资源管理器)
// detection idiom
template <class...>
using void_t = void;
template <class Void, template <class...> class Op, class... Args>
struct detector_base
{
using type = void;
};
template <template <class...> class Op, class... Args>
struct detector_base<void_t<Op<Args...>>, Op, Args...>
{
using type = Op<Args...>;
};
template <class T>
using check = decltype(T::x);
template <typename T>
struct type {};
using dt = typename detector_base<void, check, int>::type; // this is void
using t = type<dt>;
// ^--- 't': use of class template requires template argument list
Run Code Online (Sandbox Code Playgroud)
使用任何模板类型的检测类型时会发生这种情况.这是编译器错误,还是由于缺乏支持(如果是这样,为什么)?