Q:

Why does the STL provide a const overload for std::container::begin and std::container::end functions?

Take any STL container in mind which uses iterators.
The following is valid:
iterator begin();
const_iterator begin() const;
const_iterator cbegin() const;

Now I don't understand why the second line exists. Could someone provide a nice example where iterator begin(); wouldn't work and it can't be replaced by const_iterator cbegin();... begging the need for const_iterator begin();?

A:

First off, there is a simple historic reason: the original C++ standard didn't use cbegin() and only had the two begin() overloads. It was felt that sometimes it would be useful to obtain const_iterators to a non-const sequence and cbegin() and cend() were added (despite begin() and end() members actually being ill-advise: we'd be much better of if they were just non-member functions). That is, if the const overload of begin() had been removed when cbegin() was introduced, at lot of code would have been broken.
From a practical point of view it is also desirable to have both the non-const and the const overloads:

use of begin() and cbegin() in normal code could be done it would be quite annoying to actually do so when changing the constness of objects
more importantly, in generic (templatized) code where sequence could be either const or non-const it would be necessary to use some dance to to use the correct overload.

