lower_bound

The function lower_bound is used to find the first position that an element may be inserted without changing the order.

  template<class ForwardIterator, class T>
  ForwardIterator lower_bound
  (ForwardIterator first, ForwardIterator last, const T& 
  value);
  template<class ForwardIterator, class T, class Compare>
  ForwardIterator lower_bound
  (ForwardIterator first, ForwardIterator last,
  const T& value, Compare comp);
  
Remarks

The position where the element can be inserted is returned.