What is the maximum possible size of mySet?

struct comp
{
bool operator() (unsigned int x, unsigned int y) {
return (x % 10) < (y % 10);
}
}

set < unsigned int, comp > mySet = {9, 12};
for ( int x : mySet) cout << x << ' ';

What is the output? What is the maximum possible size of mySet?

Hello @duttrohan0302,

Output will be 12 9.

  1. You can check the maximum possible size of the set using set_name.max_size() function.
    Refer to the link.

  2. See the output for your question.
    https://ide.codingblocks.com/s/184885

  3. Maximum possible size of STL containers depends upon the system/upon the memory available.

Hope, this would help.
Give a like if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.