<p>Suppose I have a set of values, stored in a std::set:</p>

<p>{1, 2, 6, 8}</p>

<p>and I have a search key, say, 3. I want to put 3 into a function and get the first value greater than or equal to 3, in this case I would want to get 6.</p>

<p>The find() function provided in map/set/multimap/and set will, of course, return the end iterator for this case. Is there a similar function to find that would return 6 in this case?</p>

You want the
upper_bound
function.
```
```
map<int, int> mymap = { 1,2,6,8 };
map<int,int>::iterator i = mymap.upper_bound(3); // returns an iterator to the '6' element.
```
```