mir_slice.accessFlat

Provides access to a slice as if it were flattened.

struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
ref scope return @trusted
@optmath
accessFlat
(
size_t index
)
if (
0 < N_ &&
N_ < 255
&&
!(
kind_ == Canonical &&
N_ == 1
)
&&
Labels_.length <= N_
&&
isIterator!Iterator_
)

Parameters

index size_t

location in slice

Return Value

Type: auto ref

value of flattened slice at index

Examples

import mir.ndslice.topology: iota, flattened;

auto x = iota(2, 3, 4);
assert(x.accessFlat(9) == x.flattened[9]);

See Also

Meta