isBidirectionalRange

Determines whether R is a bidirectional range.

A bidirectional range is a forward range that also defines:

  • back
  • popBack

Members

Variables

isBidirectionalRange
enum bool isBidirectionalRange;
Undocumented in source.
isBidirectionalRange
enum bool isBidirectionalRange;
Undocumented in source.

Parameters

R

The type to be tested.

Return Value

$(D_KEYWORD true) if R is a bidirectional range, $(D_KEYWORD false) otherwise.

Examples

static struct Range
{
    void popFront() @nogc nothrow pure @safe
    {
    }

    void popBack() @nogc nothrow pure @safe
    {
    }

    @property int front() @nogc nothrow pure @safe
    {
        return 0;
    }

    @property int back() @nogc nothrow pure @safe
    {
        return 0;
    }

    bool empty() const @nogc nothrow pure @safe
    {
        return true;
    }

    Range save() @nogc nothrow pure @safe
    {
        return this;
    }
}
static assert(isBidirectionalRange!Range);
static assert(isBidirectionalRange!(int[]));
static assert(!isBidirectionalRange!(void[]));

See Also

$(D_PSYMBOL isForwardRange).

Meta