View source code
Display the source code in std/container/slist.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Module std.container.slist
This module implements a singly-linked list container. It can be used as a stack.
This module is a submodule of std
.
Example
import std .algorithm .comparison : equal;
import std .container : SList;
auto s = SList!int(1, 2, 3);
assert(equal(s[], [1, 2, 3]));
s .removeFront();
assert(equal(s[], [2, 3]));
s .insertFront([5, 6]);
assert(equal(s[], [5, 6, 2, 3]));
// If you want to apply range operations, simply slice it.
import std .algorithm .searching : countUntil;
import std .range : popFrontN, walkLength;
auto sl = SList!int(1, 2, 3, 4, 5);
writeln(countUntil(sl[], 2)); // 1
auto r = sl[];
popFrontN(r, 2);
writeln(walkLength(r)); // 3
Structs
Name | Description |
---|---|
SList
|
Implements a simple and fast singly-linked list. It can be used as a stack. |
Authors
License
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at ).
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.