UniqueTake

Undocumented in source.
struct UniqueTake (
Range
) if (
isInputRange!(Unqual!Range) &&
!(
(
!isInfinite!(Unqual!Range) &&
hasSlicing!(Unqual!Range)
)
||
is(Range T == UniqueTake!T)
)
) {}

Constructors

this
this(R source, size_t _maxAvailable)
Undocumented in source.

Members

Aliases

Source
alias Source = R
Undocumented in source.
opDollar
alias opDollar = length

Range primitives

opDollar
alias opDollar = length
Undocumented in source.

Functions

moveAt
auto moveAt(size_t index)
moveBack
auto moveBack()
opIndex
auto ref opIndex(size_t index)
opIndexAssign
void opIndexAssign(ElementType!R v, size_t index)
opSlice
auto opSlice(size_t i, size_t j)
popBack
void popBack()
popFront
void popFront()
back
auto ref back [@property getter]
ElementType!R back [@property setter]

Range primitives

Properties

empty
bool empty [@property getter]
front
auto ref front [@property getter]
ElementType!R front [@property setter]
length
size_t length [@property getter]

Range primitives

maxLength
size_t maxLength [@property getter]

Access to maximal length of the range. Note: the actual length of the range depends on the underlying range. If it has fewer elements, it will stop before maxLength is reached.

save
UniqueTake save [@property getter]

Range primitives

Variables

source
R source;

User accessible in read and write

Examples

array range

import nxt.dynamic_array : SA = DynamicArray;
import std.traits : isIterable;
import std.range.primitives : isInputRange;
alias C = SA!int;

auto cs = C([11, 13].s).intoUniqueRange;

alias CS = typeof(cs);
static assert(isInputRange!(typeof(cs)));
static assert(isIterable!(typeof(cs)));

assert(cs.front == 11);
cs.popFront();

assert(cs.front == 13);
cs.popFront();

assert(cs.empty);

Meta