Enum member isBidirectionalRange
Determines whether R is a bidirectional range.
enum isBidirectionalRange(R)
= isForwardRange!R && (U() == Primitive!(R, "front()")());
A bidirectional range is a forward range that also defines:
- back
- popBack
Parameters
Name | Description |
---|---|
R | The type to be tested. |
Returns
true if R is a bidirectional range, false otherwise.
See Also
isForwardRange.
Example
static struct Range
{
void popFront() @nogc nothrow pure @safe
{
}
void popBack() @nogc nothrow pure @safe
{
}
@property int front() @nogc nothrow pure @safe
{
return 0;
}
@property int back() @nogc nothrow pure @safe
{
return 0;
}
bool empty() const @nogc nothrow pure @safe
{
return true;
}
Range save() @nogc nothrow pure @safe
{
return this;
}
}
static assert(isBidirectionalRange!Range);
static assert(isBidirectionalRange!(int[]));
static assert(!isBidirectionalRange!(void[]));