Indexed.physicalIndex

Returns the physical index into the source range corresponding to a given logical index. This is useful, for example, when indexing an Indexed without adding another layer of indirection.

struct Indexed(Source, Indices)
static if(isRandomAccessRange!Indices)
size_t
physicalIndex
()
if (
isRandomAccessRange!Source &&
isInputRange!Indices
&&
is(typeof(Source.init[ElementType!(Indices).init]))
)

Examples

auto ind = indexed([1, 2, 3, 4, 5], [1, 3, 4]);
assert(ind.physicalIndex(0) == 1);

Meta