.erase()

The .erase() method removes a single value from a set.

Syntax

setName.erase(value);

The value is the element to be removed from the set.

Codebyte Example

The following example uses .erase() to remove elements from the stoneFruits set:

Code
Output
Loading...

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn C++ on Codecademy