迭代器类型:iterator & const_iterator

 

	vector<int> ivec{1, 3, 4, 1, 3, 4};
	vector<int>::iterator iter;			// iter能读写vector<int>的元素 
	vector<int>::const_iterator iter;	// iter只能读元素,不能写元素
	
	auto it = ivec.begin();				// it的类型为iterator 
	auto it = ivec.cbegin(); 			// it的类型为const_iterator 

  

posted @ 2018-03-24 09:07  GGBeng  阅读(195)  评论(0编辑  收藏  举报