/** * @brief Finds the first position in which @a val could be inserted * without changing the ordering. * @param first An iterator. * @param last Another iterator. * @param val The search term. * @return An iterator pointing to the first element <em>not less * than</em> @a val, or end() if every element is less than * @a val. * @ingroup binary_search_algorithms */ template<typename _ForwardIterator, typename _Tp> _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType;
/** * @brief Finds the last position in which @a val could be inserted * without changing the ordering. * @ingroup binary_search_algorithms * @param first An iterator. * @param last Another iterator. * @param val The search term. * @return An iterator pointing to the first element greater than @a val, * or end() if no elements are greater than @a val. * @ingroup binary_search_algorithms */ template<typename _ForwardIterator, typename _Tp> _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType;