摘要: const 修饰指针:如果关键字const出现在星号*左边,表示被指物是常量,如果const出现在*右边表示指针自身是常量, 如果出现在两边表示被指物和指针都是常量; const std::vector<int>::iterator iter = vec.begin(); //iter的作用就像是T* const; ++iter;错误 std::vector<int>::const_iterator cIter = vec.begin(); //cIter的作用像个const T*; *cIter = 10;错误 const 修饰函数返回值:将operator*的返回值 阅读全文
posted @ 2012-01-05 23:11 lidan 阅读(290) 评论(0) 推荐(0) 编辑