Stl lower_bound in set Q 7

Why answer is not -garbage value but 6.
In my opinion if you do *( s.end() ) then answer should be a garbage value.
Please help me

hello @Rhinorox
yeah it wil not be garbage value. *s.end()= number of elements in the set.

there are 6 elements in the set ,thatswhy answer should be 6.

iterator *it is pointing to the s.end(_), means *it is pointing to the element coming after the last element in the set.

So, you are basically telling me that the element coming after the last element of the set is the !!!total no of elements!!!

yeah… . . … . … …

u can try on ur own by inserting some items.

YOU SHOULD HAVE TOLD ME THAT

For set, s.end()=no. of elements; For vector, v.end()=0; For list, l.end(_)=some garbage value; Anyway thanks.