Return value of insert in sets

#include <bits/stdc++.h>
using namespace std;
int main()
{
sets;
pair<set::iterator, bool> ret;
s.insert(1);
s.insert(5);
s.insert(10);
s.insert(3);
ret = s.insert(10);
cout<<ret.second<<endl;
return 0;
}

Can you explain how “pair<set::iterator, bool> ret;” this line works?

@sivaganeshdaggubati hii see this code gives an error you cant declares set like this first and tell me what are you going to do

This is the question asked in stl quiz,putting declaration part ahead can you expalin these lines “pair<set::iterator, bool> ret;”,ret = s.insert(10);
cout<<ret.second<<endl;

@sivaganeshdaggubati can u give me ss of this question ??

@sivaganeshdaggubati
your code which u give shows that insert fun in the set returns a pair which contains set:iterator and the value bool. The insert function is used to add new elements in set. We just depicted that the return value of set is a pair of set:iterator pointing to the element and value of element which we just insert

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.