.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...
Looking to contribute?

Learn C++ on Codecademy