Enum member isForwardRange

Determines whether R is a forward range.

enum isForwardRange(R) = isInputRange!R && is(U == R);

A forward range is an input range that also defines:

Parameters

NameDescription
R The type to be tested.

Returns

true if R is a forward range, false otherwise.

See Also

isInputRange.

Example

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

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

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

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