Need more explanation about what the ret function is doing?

What will be the output of following C++ code?

#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;
}

How is the answer 0?

hi @deepak_four ret is not a function, its a value that is storing the value returned by the function insert. You can read more about the return type of insert function in the documentation, http://www.cplusplus.com/reference/set/set/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.