title: How to find all elements in a range in STL map(set)
body: <p>I have a map in stl and a range [lo, hi].</p>
  
  <p>What is the best way to find all elements in map which fit in this range?</p>
  
  <p>UDT:</p>
  
  <p>The question about upper_bound and low_bound is:</p>
  
  <p>For example I have a set or map with {1, 2, 7, 8} and my range is [3,6]. lower_bound will points to 7 and upper_bound to 2. Assume I don't want to erase smith, but just write out all elements in a range. How can I do it? And what complexity will be for erasing in this case?</p>