vector and const

后端 未结 10 1714
無奈伤痛
無奈伤痛 2020-12-03 07:13

Consider this

 void f(vector& p)
 {
 }
 int main()
 { 
  vector nonConstVec;
  f(nonConstVec);
 }

The followi

10条回答
  •  星月不相逢
    2020-12-03 07:47

    in addition to other answers, it's worth reading C++ FQA Lite where this (and many others C++ features) are discussed from a critical POV: http://yosefk.com/c++fqa/const.html#fqa-18.1

提交回复
热议问题