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
lower_bound() finds the first element with key >= key. This includes an
exact key match when present, which is useful for starting equality or
inclusive range scans.
Examples
x <- ordered_sequence("a", "b", "c", keys = c(1, 2, 2))
lower_bound(x, 2)
#> $found
#> [1] TRUE
#>
#> $index
#> [1] 2
#>
#> $value
#> [1] "b"
#>
#> $key
#> [1] 2
#>
lower_bound(x, 10)
#> $found
#> [1] FALSE
#>
#> $index
#> NULL
#>
#> $value
#> NULL
#>
#> $key
#> NULL
#>