Find First Element with Key > Query
Value
A list with fields:
found: logical flag.index: one-based position of the first match, orNULL.value: matched element, orNULL.key: matched key, orNULL.
Details
upper_bound() finds the first element with key > key. This skips exact
key matches, which is useful for exclusive range endpoints and for finding
the position immediately after a duplicate-key run.
Examples
x <- ordered_sequence("a", "b", "c", keys = c(1, 2, 2))
upper_bound(x, 2)
#> $found
#> [1] FALSE
#>
#> $index
#> NULL
#>
#> $value
#> NULL
#>
#> $key
#> NULL
#>
upper_bound(x, 10)
#> $found
#> [1] FALSE
#>
#> $index
#> NULL
#>
#> $value
#> NULL
#>
#> $key
#> NULL
#>