#include#include int main() { std::multiset s = {1, 2, 2, 2, 3, 5, 5}; auto it = s.lower_bound(2); std::cout << *it << std::endl; // output: 2 }
#includeIn this example, the lower_bound function is used to find the first occurrence of the element 3 in the sorted multiset. The iterator is then incremented to point to the next element in the set, which is 5. The output prints the value of this element. The multiset container and its member functions are part of the C++ Standard Library.#include int main() { std::multiset s = {1, 3, 3, 5, 6}; auto it = s.lower_bound(3); ++it; std::cout << *it << std::endl; // output: 5 }