.clear()

The .clear() method removes all values from a set. This will destroy every value and the container will be of size 0.

Syntax

setName.clear();

Codebyte Example

The following shows the .clear() method being used on the composers set:

Code
Output
Loading...
Looking to contribute?

Learn C++ on Codecademy