Template Function ADS::branchlessLowerBound

Function Documentation

template<class T, class C = std::less<>>
std::size_t ADS::branchlessLowerBound(const std::vector<T> &A, const T &v, C less = C())

the first place of an item not smaller than v in the sorted A, n if none, by the binary search with no branch

Pre:

A is sorted (an audit)

Post:

A[ r - 1 ] < v <= A[ r ]