关于const string和string
  • 板块学术版
  • 楼主Miller2019
  • 当前回复8
  • 已保存回复8
  • 发布时间2020/7/16 16:02
  • 上次更新2023/11/6 23:01:30
查看原帖
关于const string和string
256340
Miller2019楼主2020/7/16 16:02

非类类型的纯右值不能进行cv限定。(反过来,类类型的纯右值可以进行cv限定这件事情其实挺坑的,比如要考虑const std::string和std::string的不同)

int fun()
const int fun() // the same
std::string foo() /*(1.)*/
const std::string foo() // not the same /*(2.)*/

那么一和二有什么区别呢?

2020/7/16 16:02
加载中...