From 629071f934bf3772776c5c9213f0e2ac1100c9e5 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 10 Mar 2018 07:17:43 +0100 Subject: [PATCH] Add information that DList can be used as a queue --- source/tanya/container/list.d | 18 +++++++++++++++--- 1 file 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. */