The OpenD Programming Language

findIndex

Finds an index such that series.index[index] == key.

size_t
findIndex
(
IndexIterator
Iterator
size_t N
SliceKind kind
Index
)
(
Series!(IndexIterator, Iterator, N, kind) series
,
auto ref scope const Index key
)

Parameters

series Series!(IndexIterator, Iterator, N, kind)

series

key Index

index to find in the series

Return Value

Type: size_t

size_t.max if the series does not contain the key and appropriate index otherwise.

Examples

auto index = [1, 2, 3, 4].sliced;
auto data = [2.1, 3.4, 5.6, 7.8].sliced;
auto series = index.series(data);

assert(series.data[series.findIndex(3)] == 5.6);
assert(series.findIndex(0) == size_t.max);

Meta