vector and const

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

Consider this

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

The followi

10条回答
  •  伪装坚强ぢ
    2020-12-03 07:52

    That's the way templates work - no conversions are applied on the template parameters, so the two vectors are of completely different types.

提交回复
热议问题