考虑一下代码:
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
Run Code Online (Sandbox Code Playgroud)
这是有道理的,因为y不是const参考,它是对a的引用const.
有没有foo这样std::foo<decltype(y)>::value的1?如果没有,那么定义我自己的是什么样的呢?