hasLvalueElements

Determines whether R provides access to its elements by reference.

Members

Variables

hasLvalueElements
enum bool hasLvalueElements;
Undocumented in source.
hasLvalueElements
enum bool hasLvalueElements;
Undocumented in source.
hasLvalueElements
enum bool hasLvalueElements;
Undocumented in source.

Parameters

R

Range type.

Return Value

$(D_KEYWORD true) if R has lvalue elements, $(D_KEYWORD false) otherwise.

Examples

static struct R1
{
    enum bool empty = false;

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

    void popFront() @nogc nothrow pure @safe
    {
    }
}
static assert(!hasLvalueElements!R1);

static struct R2
{
    int element;
    enum bool empty = false;

    ref const(int) front() const @nogc nothrow pure @safe
    {
        return element;
    }

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

    ref const(int) opIndex(size_t) const @nogc nothrow pure @safe
    {
        return element;
    }
}
static assert(hasLvalueElements!R2);

Meta