summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2017-01-04 20:37:55 +0100
committerEugen Wissner <belka@caraus.de>2017-01-04 20:37:55 +0100
commite27d0fe58cae50e9f592a8db6b5052a19f3bcba3 (patch)
tree828ffaa328d59a4a0163a3f678df2beb1b5cdd3b
parent67952dabdb28e504cdc0e34c9f7151e7ffb71ff2 (diff)
downloadtanya-e27d0fe58cae50e9f592a8db6b5052a19f3bcba3.tar.gz
Fix Vector.remove not destroying from the end copied elements
-rw-r--r--README.md4
-rw-r--r--source/tanya/container/vector.d6
2 files changed, 6 insertions, 4 deletions
diff --git a/README.md b/README.md
index a1c7215..3605e39 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@ data structures and utilities that depend on the Garbage Collector in Phobos.
Tanya consists of the following packages:
-* `async`: Event loop.
-* `container`: Queue, Vector, Singly linked list.
+* `async`: Event loop (epoll, kqueue and IOCP).
+* `container`: Queue, Vector, Singly linked list, buffers.
* `crypto`: Work in progress TLS implementation.
* `math`: Multiple precision integer and a set of functions.
* `memory`: Tools for manual memory management (allocator, reference counting,
diff --git a/source/tanya/container/vector.d b/source/tanya/container/vector.d
index 0992733..e582714 100644
--- a/source/tanya/container/vector.d
+++ b/source/tanya/container/vector.d
@@ -650,6 +650,8 @@ struct Vector(T)
* r = Range originally obtained from this vector.
*
* Returns: Elements in $(D_PARAM r) after removing.
+ *
+ * Precondition: $(D_PARAM r) refers to a region of $(D_KEYWORD this).
*/
Range!T remove(Range!T r) @trusted
in
@@ -663,7 +665,7 @@ struct Vector(T)
{
*a = *b;
}
- length_ -= r.length;
+ length = length_ - r.length;
return r;
}
@@ -790,7 +792,7 @@ struct Vector(T)
ref T opIndexAssign(ref T value, in size_t pos) @trusted
in
{
- assert(length > pos);
+ assert(length_ > pos);
}
body
{