Why not compilation error

ret is a pair,ret=s.insert(10); this statement doesn’t make sense .how are two different entities assigned here.Need explanation…

Please paste the complete question here so that i can check.

Output of the 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;
}

Refer this Set c++ stl question

1 Like

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.