Prefer const_iterators to iterators (Notes)
NOTE My notes on Chapter 3, Item 13 of Effective Modern C++ written by Scott Meyers. Some (or even all) of the text can be similar to what you see in the book, as these are notes: I’ve tried not to be unnecessarily creative with my words. :) In C++, iterators come handy to point at memory addresses of STL containers. For example, // C++11 std::vector<int> x {11, 9, 23, 6}; // begin() member function returns an iterator, which points to the first // memory address of the container x std::vector<int>::iterator it = x.begin(); While the general practice is to use const whenever possible, but programmers tend to use whenever it’s practical. const_iterators is particularly suggested when you want to use iterators, but you don’t need to modify what it points to. ...