Range type.
$(D_KEYWORD true) if R has swappable elements, $(D_KEYWORD false) otherwise.
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(hasSwappableElements!R1); static struct R2 { int element; enum bool empty = false; 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(!hasSwappableElements!R2);
Determines whether the elements of $(D_PSYMBOL R) can be swapped with $(D_PSYMBOL swap).