Merge pull request #133 from Herringway/safe-queue
mark Queue as @safe merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
commit
890200e77b
|
@ -99,7 +99,7 @@ struct Queue(T)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Push new item to the queue.
|
/// Push new item to the queue.
|
||||||
void push(T item) @trusted nothrow
|
void push(T item) @safe nothrow
|
||||||
{
|
{
|
||||||
Node* newLast = newNode(item, null);
|
Node* newLast = newNode(item, null);
|
||||||
if(last_ !is null) { last_.next_ = newLast; }
|
if(last_ !is null) { last_.next_ = newLast; }
|
||||||
|
@ -109,7 +109,7 @@ struct Queue(T)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert a new item putting it to specified index in the linked list.
|
/// Insert a new item putting it to specified index in the linked list.
|
||||||
void insert(T item, const size_t idx) @trusted nothrow
|
void insert(T item, const size_t idx) @safe nothrow
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(idx <= length_);
|
assert(idx <= length_);
|
||||||
|
@ -136,7 +136,7 @@ struct Queue(T)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the next element in the queue and remove it.
|
/// Return the next element in the queue and remove it.
|
||||||
T pop() @trusted nothrow
|
T pop() @safe nothrow
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(!empty, "Trying to pop an element from an empty queue");
|
assert(!empty, "Trying to pop an element from an empty queue");
|
||||||
|
|
Loading…
Reference in a new issue