.erase()

Published May 4, 2022Updated Dec 21, 2022
Contribute to Docs

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:

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn C++ on Codecademy