The multiset::upper_bound() is a built-in function in C++ STL which returns an iterator pointing to the immediate next element which is just greater than k. If the key passed in the parameter exceeds the maximum key in the container, then the iterator returned points an element which points to the position after the last element in the container.
Parameters: This function accepts a single mandatory parameter key which specifies the element whose upper_bound is to be returned.
Return Value: The function returns an iterator.
Below programs illustrate the above function:
The multiset elements are: 1 3 3 4 5 The upper bound of key 3 is 4 The upper bound of key 2 is 3 The upper bound of key 10 is 5
The multiset elements are: 10 13 13 24 25 The upper bound of key 10 is 13 The upper bound of key 2 is 13 The upper bound of key 24 is 25
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
- multiset lower_bound() in C++ STL with Examples
- multiset max_size() in C++ STL with Examples
- multiset size() in C++ STL with Examples
- multiset::operator= in C++ STL
- multiset::swap() in C++ STL
- multiset::emplace() in C++ STL
- multiset find() function in C++ STL
- multiset equal_range() function in C++ STL
- multiset emplace_hint() function in C++ STL
- multiset rbegin() and rend() function in C++ STL
- multiset begin() and end() function in C++ STL
- multiset get_allocator() function in C++ STL
- multiset max_size() in C++ STL
- multiset key_comp() function in C++ STL
- multiset value_comp() method in C++ STL
- multiset erase() in C++ STL
- Difference between pair in Multiset and Multimap in C++ STL
- Multiset in C++ Standard Template Library (STL)
- multiset clear() function in C++ STL
- multiset insert() function in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : arorakashish0911