View source code
Display the source code in std/range/package.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

std.range.FrontTransversal/frontTransversal - multiple declarations

Function frontTransversal

Given a range of ranges, iterate transversally through the first elements of each of the enclosed ranges.

FrontTransversal!(RangeOfRanges,opt) frontTransversal(TransverseOptions opt = TransverseOptions.assumeJagged, RangeOfRanges) (
  RangeOfRanges rr
);

Example

import std.algorithm.comparison : equal;
int[][] x = new int[][2];
x[0] = [1, 2];
x[1] = [3, 4];
auto ror = frontTransversal(x);
assert(equal(ror, [ 1, 3 ][]));

Struct FrontTransversal

Given a range of ranges, iterate transversally through the first elements of each of the enclosed ranges.

struct FrontTransversal(Ror, TransverseOptions opt = TransverseOptions.assumeJagged) ;

Constructors

NameDescription
this (input) Construction from an input.

Properties

NameTypeDescription
back[get] autoBidirectional primitives. They are offered if isBidirectionalRange!RangeOfRanges.
front[get] autoForward range primitives.
save[get] FrontTransversalDuplicates this frontTransversal. Note that only the encapsulating range of range will be duplicated. Underlying ranges will not be duplicated.

Methods

NameDescription
moveAt (n) Random-access primitive. It is offered if isRandomAccessRange!RangeOfRanges && (opt == TransverseOptions.assumeNotJagged || opt == TransverseOptions.enforceNotJagged).
moveBack () Bidirectional primitives. They are offered if isBidirectionalRange!RangeOfRanges.
moveFront () Forward range primitives.
opIndex (n) Random-access primitive. It is offered if isRandomAccessRange!RangeOfRanges && (opt == TransverseOptions.assumeNotJagged || opt == TransverseOptions.enforceNotJagged).
opIndexAssign (val, n) Random-access primitive. It is offered if isRandomAccessRange!RangeOfRanges && (opt == TransverseOptions.assumeNotJagged || opt == TransverseOptions.enforceNotJagged).
opSlice (lower, upper) Slicing if offered if RangeOfRanges supports slicing and all the conditions for supporting indexing are met.
popBack () Bidirectional primitives. They are offered if isBidirectionalRange!RangeOfRanges.
popFront () Forward range primitives.

Example

import std.algorithm.comparison : equal;
int[][] x = new int[][2];
x[0] = [1, 2];
x[1] = [3, 4];
auto ror = frontTransversal(x);
assert(equal(ror, [ 1, 3 ][]));

Authors

Andrei Alexandrescu, David Simcha, Jonathan M Davis, and Jack Stouffer. Credit for some of the ideas in building this module goes to Leonardo Maffi.

License

Boost License 1.0.