lbound

Performs a binary search of buf, returning the index of the first location where pat may be inserted without disrupting sort order. If the sort order of pat precedes all elements in buf then 0 will be returned. If the sort order of pat succeeds the largest element in buf then buf.length will be returned. Comparisons will be performed using the supplied predicate or '<' if none is supplied.

  1. size_t lbound(Elem[] buf, Elem pat, Pred2E pred)
    version(TangoDoc)
    lbound
  2. template lbound(Buf, Pat)
  3. template lbound(Buf, Pat, Pred)

Parameters

buf Elem[]

The sorted array to search.

pat Elem

The pattern to search for.

pred Pred2E

The evaluation predicate, which should return true if e1 is less than e2 and false if not. This predicate may be any callable type.

Return Value

Type: size_t

The index of the first match or buf.length if no match was found.

Meta