我正在尝试使用gcc和clang编译此代码:
#include <iostream>
#include <type_traits>
template<int N>
struct Test
{
template<typename = std::enable_if_t<N == 1,bool>>
void func()
{
std::cout << "Test::func" << std::endl;
}
};
int main()
{
Test<0> t;
//t.func();
}
所以,我有一个错误:
error: no type named 'type' in 'std::__1::enable_if<false,bool>'; 'enable_if' cannot be used to
disable this declaration
template <bool _Bp,class _Tp = void> using enable_if_t = typename enable_if<_Bp,_Tp>::type;
但是,如果我使用vc ++编译该代码,则不会出错。 那么,哪个编译器根据c ++标准解决了此问题?