const_iterator与const的iterator的区别:
通过简单的代码区别,更能说明问题,希望你能明白
vector<int> ivec;
vector<int>::const_iterator citer1 = ivec.begin();
const vector<int>::iterator citer2 = ivec.begin();
*citer1 = 1; //error
*citer2 = 1; //right
++citer1; //right
++citer2; //error
const_iterator与const的iterator的区别
最新推荐文章于 2024-03-12 16:36:31 发布