c++stl

The difference between front() and begin()


What is the difference between the front() and begin() functions that appears in many STL containers?


Solution

  • begin() returns an iterator that can be used to iterate through the collection, while front() just returns a reference to the first element of the collection.