template<typename T,typename U = void>
struct Test
{
static const int value = 0;
};
template<typename T>
struct Test<T, decltype((void)T{})>
{
static const int value = 2;
};
template<typename T>
struct Test<T*, decltype((void)T{})>
{
static const int value = 1;
};
int main(){
cout<<Test<int*>::value<<endl;
return 0;
}
code on gcc/clang both get error:ambiguous ,but decltype change to void_t is ok.why?
Aucun commentaire:
Enregistrer un commentaire