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

empty
bool empty()
front
auto ref front()
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()
save
UniqueTake save()
back
auto ref back [@property getter]
ElementType!R back [@property setter]
front
ElementType!R front [@property setter]
length
size_t length [@property getter]

Range primitives

Properties

lengthMax
size_t lengthMax [@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 lengthMax is reached.

Variables

source
R source;

User accessible in read and write

Examples

array range

import std.experimental.allocator.mallocator : Mallocator;
import nxt.container.dynamic_array : DA = DynamicArray;
import std.traits : isIterable;
import std.range.primitives : isInputRange;
alias C = DA!(int, Mallocator);

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