It’s a very useful function to find elements in map.
iterator lower_bound (const key_type& k); Returns an iterator pointing to the first element in the container whose key is not considered to go before k (i.e., either it is equivalent or goes after).
iterator upper_bound (const key_type& k); Returns an iterator pointing to the first element in the container whose key is considered to go after k.
itlow=mymap.lower_bound ('c'); // find the first key element that is at least greater(>=) than 'c' // in this case, it's 'd' itlow=mymap.lower_bound ('b'); // find the first key element that is at least greater(>=) than 'c' // in this case, it's 'd'
itup=mymap.upper_bound ('d'); // find the first element that is definite greater than 'd' // point to something > 'd' and not including 'd', so it's 't'