C++ Standard Library lower_bound() Sample

Description

lower_bound() finds the lower bound of a range of equal elements in a sorted sequence, and returns an iterator to the first element of the range. If the specified element is not found, it returns an iterator to the first element with a key greater than the specified element, or an iterator reference to the end of the list if no such element exists.

Declaration

	template <class For, class T>
	    For lower_bound(For, For, const T&);
	template <class For, class T, class Cmp>
	    For lower_bound(For, For, const T&, Cmp);

Concept

This example sets up a five-long sorted vector, and computes the lower and upper bounds of the element 2. The range is then displayed.

Supported
Supported
Supported