C++ Erase Function Parameters

The erase function in C++ is a function used to delete elements in a container, with the following parameters.

  1. position of the iterator
  2. The first iterator
  3. the last element in the iterator
  4. n of type size_type

The position and n parameters are mutually exclusive, meaning you can only choose one. The parameters first and last can be used to define a range of elements to delete, or you can specify just the first parameter to delete a single element.

bannerAds