Skip to content

Latest commit

History

History
23 lines (16 loc) 路 529 Bytes

size.md

File metadata and controls

23 lines (16 loc) 路 529 Bytes

size

Description : This method is used to return the size of set. The return type is size_t (quite similar to unsigned integer), which overflows when a bigger number is subtracted from it.

Example :

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

int main(){
    // Create a set object holding integers
    std::set<int> mySet {1,2,3,4,-5};

    std::cout << "Size of my set is : " << mySet.size() << std::endl;

    return 0;
}

Run Code