set max_size() in C++

max_size(): This is a build-in function in STL. This function returns the maximum 

size of the set. 

This function is available in the below file.

File: stl_set.h

Parameters: No parameters are required for this function.

Syntax:

st.max_size()

For Example:

st = {1,2,3,4}

st.max_size() = > It returns max_size (i.e 461168601842738790)

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    set<intst;
    st.insert({1243});

    cout << st.max_size() << "\n";

    return 0;
}


No comments:

Post a Comment