Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dip1000.mak
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ aa[std.zlib]=-dip1000
aa[std.algorithm.comparison]=-dip1000
aa[std.algorithm.internal]=-dip1000
aa[std.algorithm.iteration]=-dip25 # WIP_carblue
aa[std.algorithm.mutation]=-dip25 # depends on std.container.slist (https://github.com/dlang/phobos/pull/6295)
aa[std.algorithm.mutation]=-dip1000
aa[std.algorithm.package]=-dip1000
aa[std.algorithm.searching]=-dip25 # depends on https://github.com/dlang/phobos/pull/6246 merged and std.algorithm.comparison fixed
aa[std.algorithm.setops]=-dip1000
Expand Down Expand Up @@ -95,7 +95,7 @@ aa[std.container.binaryheap]=-dip1000
aa[std.container.dlist]=-dip1000
aa[std.container.package]=-dip1000
aa[std.container.rbtree]=-dip25 # DROP
aa[std.container.slist]=-dip25 # -dip1000 -version=DIP1000 depends on https://github.com/dlang/phobos/pull/6295 merged
aa[std.container.slist]=-dip1000 -version=DIP1000 # merged https://github.com/dlang/phobos/pull/6295
aa[std.container.util]=-dip25 # TODO

aa[std.datetime.date]=-dip25 # depends on a fix for writefln
Expand Down
31 changes: 28 additions & 3 deletions std/container/slist.d
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,22 @@ struct SList(T)
/**
Constructor taking a number of nodes
*/
this(U)(U[] values...) if (isImplicitlyConvertible!(U, T))
this(U)(scope U[] values...) if (isImplicitlyConvertible!(U, T))
{
insertFront(values);
initialize();
Node* n, newRoot;
foreach (item; values)
{
auto newNode = new Node(null, item);
(newRoot ? n._next : newRoot) = newNode;
n = newNode;
}
if (n)
{
// Last node points to the old root
n._next = _first;
_first = newRoot;
}
}

/**
Expand Down Expand Up @@ -359,7 +372,7 @@ Complexity: $(BIGOH m), where $(D m) is the length of $(D stuff)
{
initialize();
size_t result;
Node * n, newRoot;
Node* n, newRoot;
foreach (item; stuff)
{
auto newNode = new Node(null, item);
Expand Down Expand Up @@ -911,3 +924,15 @@ Complexity: $(BIGOH n)
s.reverse();
assert(s[].equal([3, 2, 1]));
}

version(DIP1000)
@safe unittest
{
int i, j;
auto s = SList!(int*)([&i, &j]);
assert(s._root);
assert(s._root._next);
assert(s._root._next._next);
assert(s._root._next._payload == &i);
assert(s._root._next._next._payload == &j);
}