Skip to content

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