Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Latest commit

History

History
23 lines (17 loc) 路 461 Bytes

clear.md

File metadata and controls

23 lines (17 loc) 路 461 Bytes

clear

Description : This method is used to remove all the elements from the set and make its size zero

Example :

//Run Code To Demonstrate use of set.clear()
#include<iostream>
#include<set>

int main(){
    // Create a set object holding integers
    std::set<int> myset {1,2,3,4,5};
    myset.clear();
    std::cout << "Size of my set is : " << myset.size() << std::endl;

    return 0;
}

Run Code