相关疑难解决方法(0)

对于const的引用,std :: is_const的等价物是什么?

考虑一下代码:

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?如果没有,那么定义我自己的是什么样的呢?

c++ types const

21
推荐指数
1
解决办法
1244
查看次数

标签 统计

c++ ×1

const ×1

types ×1