Consider the code:
int const x = 50;
int const& y = x;
cout << std::is_const<decltype(x)>::value << endl; // 1
cout << std::is_const<decltype(y)>::value << endl; // 0
This makes sense, because y is not a const reference, it is a reference to a const.
Is there a foo such that std::foo<decltype(y)>::value is 1? If not, what would it look like to define my own?
Use remove_reference:
See on coliru