CMS 3D CMS Logo

Functions
alpaka_std Namespace Reference

Functions

template<typename RandomIt , typename T , typename Compare = std::less<T>>
ALPAKA_FN_HOST_ACC constexpr RandomIt upper_bound (RandomIt first, RandomIt last, const T &value, Compare comp={})
 

Function Documentation

◆ upper_bound()

template<typename RandomIt , typename T , typename Compare = std::less<T>>
ALPAKA_FN_HOST_ACC constexpr RandomIt alpaka_std::upper_bound ( RandomIt  first,
RandomIt  last,
const T value,
Compare  comp = {} 
)

Definition at line 17 of file alpakastdAlgorithm.h.

Referenced by cms::alpakatools::countFromVector::operator()(), and cms::alpakatools::fillFromVector::operator()().

17  {}) {
18  auto count = last - first;
19 
20  while (count > 0) {
21  auto it = first;
22  auto step = count / 2;
23  it += step;
24  if (!comp(value, *it)) {
25  first = ++it;
26  count -= step + 1;
27  } else {
28  count = step;
29  }
30  }
31  return first;
32  }
Definition: value.py:1
step
Definition: StallMonitor.cc:83