Enum member hasAssignableElements

Determines whether the elements of R are assignable.

enum hasAssignableElements(R) = assignable;

Parameters

NameDescription
R Range type.

Returns

true if the elements of R are assignable false otherwise.

Example

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

    ref int front() @nogc nothrow pure @safe
    {
        return element;
    }
    alias back = front;

    void popFront() @nogc nothrow pure @safe
    {
    }
    alias popBack = popFront;

    R1 save() const @nogc nothrow pure @safe
    {
        return this;
    }
}
static assert(hasAssignableElements!R1);

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

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

    void popFront() @nogc nothrow pure @safe
    {
    }
    alias popBack = popFront;

    R2 save() const @nogc nothrow pure @safe
    {
        return this;
    }
}
static assert(!hasAssignableElements!R2);