From 7b5cf4cf91885165680a3508bb79b7f33ea66549 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Wed, 2 Mar 2016 21:03:38 +0200 Subject: [PATCH] fix: {s,d}list should be an InputRange --- std/container/dlist.d | 12 ++++++++++++ std/container/slist.d | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/std/container/dlist.d b/std/container/dlist.d index 4f8cea4061c..4e4a3fecd5e 100644 --- a/std/container/dlist.d +++ b/std/container/dlist.d @@ -304,6 +304,7 @@ Complexity: $(BIGOH n). { return DList(this[]); } + alias save = dup; /** Returns a range that iterates over all elements of the container, in @@ -514,6 +515,7 @@ Complexity: $(BIGOH 1). /// ditto alias stableRemoveFront = removeFront; + alias popFront = removeFront; /// ditto void removeBack() @@ -525,6 +527,7 @@ Complexity: $(BIGOH 1). /// ditto alias stableRemoveBack = removeBack; + alias popBack = removeBack; /** Removes $(D howMany) values at the front or back of the @@ -944,3 +947,12 @@ private: a.insertFront(iota(0, 5)); // can insert range with non-ref front assert(a.front == 0 && a.back == 4); } + +unittest +{ + import std.range; + // should be an input, forward and bidirectional range + assert(isInputRange!(DList!int)); + assert(isForwardRange!(DList!int)); + assert(isBidirectionalRange!(DList!int)); +} diff --git a/std/container/slist.d b/std/container/slist.d index 7a1154b5d0c..a08fd11692e 100644 --- a/std/container/slist.d +++ b/std/container/slist.d @@ -210,6 +210,7 @@ Complexity: $(BIGOH n). { return SList(this[]); } + alias save = dup; /** Returns a range that iterates over all elements of the container, in @@ -373,6 +374,7 @@ Complexity: $(BIGOH 1). /// ditto alias stableRemoveFront = removeFront; + alias popFront = removeFront; /** Removes $(D howMany) values at the front or back of the @@ -778,3 +780,11 @@ unittest SList!int s; s.clear(); } + +unittest +{ + import std.range; + // should be an input and forward range + assert(isInputRange!(SList!int)); + assert(isForwardRange!(SList!int)); +}