.erase()

KyraThompson's avatar
Published May 10, 2022Updated Dec 21, 2022
Contribute to Docs

The .erase() method removes an element by it’s key from a map.

Syntax

mapName.erase(key);

The key is the element to be erased.

Codebyte Example

The following codebyte example uses .erase() to remove an element from the fields map:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn C++ on Codecademy