hasMobileElements

Determines whether $(D_PSYMBOL R) is a range containing mobile elements, i.e. elements that can be moved out of the range.

Having mobile elements means for an input range to support $(D_PSYMBOL moveFront), for a bidirectional range - both, $(D_PSYMBOL moveFront) and $(D_PSYMBOL moveBack), for a random-access range - $(D_PSYMBOL moveFront) and $(D_PSYMBOL moveAt).

Members

Variables

hasMobileElements
enum bool hasMobileElements;
Undocumented in source.
hasMobileElements
enum bool hasMobileElements;
Undocumented in source.
hasMobileElements
enum bool hasMobileElements;
Undocumented in source.

Parameters

R

Range type.

Return Value

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

Examples

static assert(hasMobileElements!(int[]));
static struct Element
{
    this(this) @nogc nothrow pure @safe
    {
    }
}

static struct R1
{
    enum bool empty = false;

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

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

static struct R2
{
    enum bool empty = false;
    private Element front_;

    ref Element front() @nogc nothrow pure @safe
    {
        return front_;
    }

    void popFront() @nogc nothrow pure @safe
    {
    }
}
static assert(hasMobileElements!R2);

See Also

$(D_PSYMBOL moveFront), $(D_PSYMBOL moveBack), $(D_PSYMBOL moveAt).

Meta