Better func attribs in Queue.
This commit is contained in:
parent
9d480d1723
commit
2688591c6a
|
@ -55,22 +55,22 @@ struct Queue(T)
|
||||||
@disable bool opEquals(ref Queue);
|
@disable bool opEquals(ref Queue);
|
||||||
@disable int opCmp(ref Queue);
|
@disable int opCmp(ref Queue);
|
||||||
|
|
||||||
///Destroy the queue, deallocating all its elements.
|
/// Destroy the queue, deallocating all its elements.
|
||||||
@safe nothrow ~this()
|
@safe nothrow ~this()
|
||||||
{
|
{
|
||||||
while(!empty){pop();}
|
while(!empty) { pop(); }
|
||||||
cursor_ = last_ = first_ = null;
|
cursor_ = last_ = first_ = null;
|
||||||
length_ = 0;
|
length_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
///Start iterating over the queue.
|
/// Start iterating over the queue.
|
||||||
void startIteration() pure @safe nothrow
|
void startIteration() @safe pure nothrow @nogc
|
||||||
{
|
{
|
||||||
cursor_ = first_;
|
cursor_ = first_;
|
||||||
}
|
}
|
||||||
|
|
||||||
///Get next element in the queue.
|
/// Get next element in the queue.
|
||||||
ref const(T) next() pure @safe nothrow
|
ref const(T) next() @safe pure nothrow @nogc
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(!empty);
|
assert(!empty);
|
||||||
|
@ -83,8 +83,8 @@ struct Queue(T)
|
||||||
return previous.payload_;
|
return previous.payload_;
|
||||||
}
|
}
|
||||||
|
|
||||||
///Are we done iterating?
|
/// Are we done iterating?
|
||||||
bool iterationOver() const pure @safe nothrow
|
bool iterationOver() @safe pure nothrow const @nogc
|
||||||
{
|
{
|
||||||
return cursor_ is null;
|
return cursor_ is null;
|
||||||
}
|
}
|
||||||
|
@ -154,8 +154,8 @@ struct Queue(T)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
///Return the next element in the queue.
|
/// Return the next element in the queue.
|
||||||
ref inout(T) peek() inout pure @safe nothrow
|
ref inout(T) peek() @safe pure nothrow inout @nogc
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(!empty, "Trying to peek at an element in an empty queue");
|
assert(!empty, "Trying to peek at an element in an empty queue");
|
||||||
|
@ -165,14 +165,14 @@ struct Queue(T)
|
||||||
return first_.payload_;
|
return first_.payload_;
|
||||||
}
|
}
|
||||||
|
|
||||||
///Is the queue empty?
|
/// Is the queue empty?
|
||||||
@property bool empty() const pure @safe nothrow
|
bool empty() @safe pure nothrow const @nogc
|
||||||
{
|
{
|
||||||
return first_ is null;
|
return first_ is null;
|
||||||
}
|
}
|
||||||
|
|
||||||
///Return number of elements in the queue.
|
/// Return number of elements in the queue.
|
||||||
@property size_t length() const pure @safe nothrow
|
size_t length() @safe pure nothrow const @nogc
|
||||||
{
|
{
|
||||||
return length_;
|
return length_;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue