summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2018-03-10 07:17:43 +0100
committerEugen Wissner <belka@caraus.de>2018-03-10 07:17:43 +0100
commit629071f934bf3772776c5c9213f0e2ac1100c9e5 (patch)
treed9ff16228d3810df7390abb035cb726a5c431fda
parent17cb592b13de89bcd120ea4e237d352cd573b709 (diff)
downloadtanya-629071f934bf3772776c5c9213f0e2ac1100c9e5.tar.gz
Add information that DList can be used as a queue
-rw-r--r--source/tanya/container/list.d18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/tanya/container/list.d b/source/tanya/container/list.d
index 4b717ed..4c99906 100644
--- a/source/tanya/container/list.d
+++ b/source/tanya/container/list.d
@@ -3,9 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
- * Linked list.
+ * This module contains singly-linked ($(D_PSYMBOL SList)) and doubly-linked
+ * ($(D_PSYMBOL DList)) lists.
*
- * Copyright: Eugene Wissner 2016-2017.
+ * Copyright: Eugene Wissner 2016-2018.
* 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)
@@ -924,7 +925,7 @@ struct SList(T)
}
/**
- * Forward range for the $(D_PSYMBOL DList).
+ * Bidirectional range for the $(D_PSYMBOL DList).
*
* Params:
* L = List type.
@@ -1014,6 +1015,17 @@ struct DRange(L)
/**
* Doubly-linked list.
*
+ * $(D_PSYMBOL DList) can be also used as a queue. Elements can be enqueued
+ * with $(D_PSYMBOL DList.insertBack). To process the queue a `for`-loop comes
+ * in handy:
+ *
+ * ---
+ * for (; !dlist.empty; dlist.removeFront())
+ * {
+ * do_something_with(dlist.front);
+ * }
+ * ---
+ *
* Params:
* T = Content type.
*/