Блог пользователя Xylenox

Автор Xylenox, история, 19 месяцев назад, По-английски
auto res = *ranges::partition_point(views::iota(lo, hi), check);

this returns the first $$$x$$$ in the range $$$[lo, hi)$$$ such that check(x) is not true, or $$$hi$$$ if it doesn't exist. Be careful to make sure the $$$lo$$$ and $$$hi$$$ are both integers of the same type, otherwise there is weird behavior.

example usage: 284450329

  • Проголосовать: нравится
  • +228
  • Проголосовать: не нравится

»
19 месяцев назад, скрыть # |
 
Проголосовать: нравится -43 Проголосовать: не нравится
»
19 месяцев назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

It might be convenient for some of us,but not necessary.In fact,a simple binary search is easy to write.