summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2017-01-13 15:23:42 +0100
committerEugen Wissner <belka@caraus.de>2017-01-13 15:23:42 +0100
commitfe884541fc8bef9d6e0efb45ce4a92e73c5666bb (patch)
tree69dbc7d8152698e496469526fa18870be538049f /source
parent8973bdb2affd36aed172ffb4a0211207cfbdc868 (diff)
downloadtanya-fe884541fc8bef9d6e0efb45ce4a92e73c5666bb.tar.gz
Rename Vector.data to Vector.get
Diffstat (limited to 'source')
-rw-r--r--source/tanya/async/event/epoll.d2
-rw-r--r--source/tanya/async/event/kqueue.d6
-rw-r--r--source/tanya/container/queue.d123
-rw-r--r--source/tanya/container/vector.d17
4 files changed, 22 insertions, 126 deletions
diff --git a/source/tanya/async/event/epoll.d b/source/tanya/async/event/epoll.d
index 408a601..48eac8d 100644
--- a/source/tanya/async/event/epoll.d
+++ b/source/tanya/async/event/epoll.d
@@ -110,7 +110,7 @@ class EpollLoop : SelectorLoop
{
// Don't block
immutable timeout = cast(immutable int) blockTime.total!"msecs";
- auto eventCount = epoll_wait(fd, events.data.ptr, maxEvents, timeout);
+ auto eventCount = epoll_wait(fd, events.get().ptr, maxEvents, timeout);
if (eventCount < 0)
{
diff --git a/source/tanya/async/event/kqueue.d b/source/tanya/async/event/kqueue.d
index eb585a8..79eac1d 100644
--- a/source/tanya/async/event/kqueue.d
+++ b/source/tanya/async/event/kqueue.d
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
- * Copyright: Eugene Wissner 2016.
+ * Copyright: Eugene Wissner 2016-2017.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
@@ -217,9 +217,9 @@ class KqueueLoop : SelectorLoop
}
auto eventCount = kevent(fd,
- changes.data.ptr,
+ changes.get().ptr,
cast(int) changeCount,
- events.data.ptr,
+ events.get().ptr,
maxEvents,
&ts);
changeCount = 0;
diff --git a/source/tanya/container/queue.d b/source/tanya/container/queue.d
index 31733e8..8c21fbc 100644
--- a/source/tanya/container/queue.d
+++ b/source/tanya/container/queue.d
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
- * Copyright: Eugene Wissner 2016.
+ * Copyright: Eugene Wissner 2016-2017.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
@@ -35,18 +35,6 @@ struct Queue(T)
}
/**
- * Removes all elements from the queue.
- */
- deprecated
- void clear()
- {
- while (!empty)
- {
- dequeue();
- }
- }
-
- /**
* Returns how many elements are in the queue. It iterates through the queue
* to count the elements.
*
@@ -55,7 +43,7 @@ struct Queue(T)
size_t length() const
{
size_t len;
- for (const(Entry!T)* i = first.next; i !is null; i = i.next)
+ for (const(Entry!T)* i = first; i !is null; i = i.next)
{
++len;
}
@@ -83,86 +71,6 @@ struct Queue(T)
assert(q.length == 0);
}
- version (D_Ddoc)
- {
- /**
- * Compares two queues. Checks if all elements of the both queues are equal.
- *
- * Returns: Whether $(D_KEYWORD this) and $(D_PARAM that) are equal.
- */
- deprecated
- int opEquals(ref typeof(this) that);
-
- /// Ditto.
- deprecated
- int opEquals(typeof(this) that);
- }
- else static if (!hasMember!(T, "opEquals")
- || (functionAttributes!(T.opEquals) & FunctionAttribute.const_))
- {
- deprecated
- bool opEquals(in ref typeof(this) that) const
- {
- const(Entry!T)* i = first.next;
- const(Entry!T)* j = that.first.next;
- while (i !is null && j !is null)
- {
- if (i.content != j.content)
- {
- return false;
- }
- i = i.next;
- j = j.next;
- }
- return i is null && j is null;
- }
-
- deprecated
- bool opEquals(in typeof(this) that) const
- {
- return opEquals(that);
- }
- }
- else
- {
- deprecated
- bool opEquals(ref typeof(this) that)
- {
- Entry!T* i = first.next;
- Entry!T* j = that.first.next;
- while (i !is null && j !is null)
- {
- if (i.content != j.content)
- {
- return false;
- }
- i = i.next;
- j = j.next;
- }
- return i is null && j is null;
- }
-
- deprecated
- bool opEquals(typeof(this) that)
- {
- return opEquals(that);
- }
- }
-
- /**
- * Returns: First element.
- */
- deprecated("Use dequeue instead.")
- @property ref inout(T) front() inout
- in
- {
- assert(!empty);
- }
- body
- {
- return first.next.content;
- }
-
/**
* Inserts a new element.
*
@@ -176,7 +84,7 @@ struct Queue(T)
auto temp = allocator.make!(Entry!T)(x);
if (empty)
{
- first.next = rear = temp;
+ first = rear = temp;
}
else
{
@@ -192,12 +100,6 @@ struct Queue(T)
return enqueue(x);
}
- deprecated("Use enqueue instead.")
- alias insert = enqueue;
-
- deprecated("Use enqueue instead.")
- alias insertBack = enqueue;
-
///
unittest
{
@@ -214,7 +116,7 @@ struct Queue(T)
*/
@property bool empty() const
{
- return first.next is null;
+ return first is null;
}
///
@@ -237,21 +139,17 @@ struct Queue(T)
in
{
assert(!empty);
- assert(allocator !is null);
}
body
{
- auto n = first.next.next;
- T ret = move(first.next.content);
+ auto n = first.next;
+ T ret = move(first.content);
- dispose(allocator, first.next);
- first.next = n;
+ allocator.dispose(first);
+ first = n;
return ret;
}
- deprecated("Use dequeue instead.")
- alias popFront = dequeue;
-
///
unittest
{
@@ -330,10 +228,7 @@ struct Queue(T)
assert(q.empty);
}
- /// The first element of the list.
- private Entry!T first;
-
- /// The last element of the list.
+ private Entry!T* first;
private Entry!T* rear;
mixin DefaultAllocator;
diff --git a/source/tanya/container/vector.d b/source/tanya/container/vector.d
index e71d203..2467325 100644
--- a/source/tanya/container/vector.d
+++ b/source/tanya/container/vector.d
@@ -180,14 +180,14 @@ private struct Range(E)
return true;
}
- @property inout(E[]) data() inout
+ inout(E[]) get() inout
{
return begin[0 .. length];
}
static if (isMutable!E)
{
- bool opEquals(Range that)
+ bool opEquals(Range that) @trusted
{
if (length != that.length)
{
@@ -1408,7 +1408,7 @@ struct Vector(T)
*
* Returns: The array with elements of this vector.
*/
- @property inout(T[]) data() inout
+ inout(T[]) get() inout
{
return vector[0 .. length];
}
@@ -1417,13 +1417,14 @@ struct Vector(T)
unittest
{
auto v = Vector!int(IL(1, 2, 4));
+ auto data = v.get();
- assert(v.data[0] == 1);
- assert(v.data[1] == 2);
- assert(v.data[2] == 4);
- assert(v.data.length == 3);
+ assert(data[0] == 1);
+ assert(data[1] == 2);
+ assert(data[2] == 4);
+ assert(data.length == 3);
- auto data = v[1 .. 2].data;
+ data = v[1 .. 2].get();
assert(data[0] == 2);
assert(data.length == 1);
}