Contents
Syntax
The syntax for
name.erase(index) name.erase(index, index) std::vector.erase(name, index) std::vector.erase(name, index, index)
@name.erase(index) @name.erase(index, index) @std::vector.erase(name, index) @std::vector.erase(name, index, index)
Description
The
- two parameters with the first parameter being the name of a standard C++ vector variable and the second variable being a valid index, it erases the element at the specified index; or
- an optional third index parameter and erases the elements between the two specified indices.
As a member function it takes:
- a single index parameter and erases the element at the specified index; or
- two index parameters and erases the elements between the two specified indices.
Note: For large scale projects you will find specifying the
f++ example
Example of
std::vector<double> v v.push_back(2.0, 5.3, 3.26) v.erase(1) std::vector.erase(v, 0) console(v.at(0))
n++ example
Example of
@std::vector<double> v @v.push_back(2.0, 5.3, 3.26) @v.erase(1) @std::vector.erase(v, 0) @console(v.at(1)) @console(std::vector.at(v, 2))