摘要: const_iterator 与 const iteratorconst_iterator:C++为每种容器类型定义了一种名为const_iterator的类型,该类型只能用于读取容器内的元素,但不能改变其值。对const_iterator类型解引用,得到的是一个指向const对象的引用。 for (vector<string>::const_iterator iter = text.begin(); iter != text.end(); ++ iter){ cout << *iter << endl; //ok: print each element i 阅读全文
posted @ 2008-08-07 16:51 MXi4oyu 阅读(178) 评论(0) 推荐(0) 编辑