anchal_vatre's blog

By anchal_vatre, history, 4 years ago, In English

for ex set<pair<string, int>> st; set.insert({"a", 1}); set.insert({"b", 1}); set.insert({"c", 1}); set.insert({"d", 1});

how to use find to get iterator on "b" ?

  • Vote: I like it
  • -3
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

u can insert {"b",2} also. which one do you want

»
4 years ago, # |
  Vote: I like it +17 Vote: I do not like it

you can use either st.upper_bound({"a",inf}) or st.lower_bound({"b",-inf})