c++ map

invisible.hippo

Arch-Supremacy Member
Joined
Nov 8, 2008
Messages
17,902
Reaction score
315
i am looking through the tutorial for map. However there's something i dont understand. In line 15 what does second in ret.second mean? Is it the second iterator?
http://www.cplusplus.com/reference/map/map/insert/

are they the same?
The pair::second element in the pair is set to true if a new element was inserted or false if an equivalent key already existed.
 
Last edited:

Tech

Member
Joined
Jan 1, 2000
Messages
243
Reaction score
0
Yes it is the same.

if a duplicated record is found it will be false, and the pair::first will be the iterator for the element which is duplicate.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top