Difference between STL list iterators C++11 -
this question has answer here:
- what reason behind cbegin/cend? 6 answers
well, see c++11, there 4 new functions in list (stl) return iterators, cbegin, cend, crbegin, crend. reading @ cplusplus (webpage), saw return const iterators of 4 kinds(beginning, end, reverse beginning , reverse end iterators), question is:
the functions existed before c++11 returned const iterators if list const-qualified (i'm talking begin, end, rbegin , rend), difference of these const iterators , returned new c++11 functions? or @ least, point of making 4 news functions when had 4 returned same const iterators?
thanks , sorry english.
cbegin always returns const_iterator
.
begin return const_iterator
if call on const container, have mutable container, , reason want const_iterator
. before, had call begin
, , explicitly cast iterator
returned const_iterator
.
Comments
Post a Comment