#include<iostream>
using namespace std;
int main() {
int* t;
using T = decltype(*t);
cout << is_integral<T>::value << endl;
return 0;
}
Why does the code above print 0?
*t
is an lvalue expression, then decltype(*t)
leads to a reference type as int&
.
b) if the value category of expression is lvalue, then decltype yields
T&
;
You might use std::remove_reference
to get the result you expected. E.g.
is_integral<remove_reference_t<T>>::value