- ElementEncodingType (from std.range)
public
import std.range : empty, front, popFront, ElementEncodingType, hasLength;
Undocumented in source.
- Unqual (from std.traits)
public
import std.traits : Unqual, hasElaborateDestructor, hasIndirections, isDynamicArray, isSafe;
Undocumented in source.
- emplace (from core.lifetime)
public
import core.lifetime : emplace, forward, move;
Undocumented in source.
- empty (from std.range)
public
import std.range : empty, front, popFront, ElementEncodingType, hasLength;
Undocumented in source.
- forward (from core.lifetime)
public
import core.lifetime : emplace, forward, move;
Undocumented in source.
- front (from std.range)
public
import std.range : empty, front, popFront, ElementEncodingType, hasLength;
Undocumented in source.
- hasElaborateDestructor (from std.traits)
public
import std.traits : Unqual, hasElaborateDestructor, hasIndirections, isDynamicArray, isSafe;
Undocumented in source.
- hasIndirections (from std.traits)
public
import std.traits : Unqual, hasElaborateDestructor, hasIndirections, isDynamicArray, isSafe;
Undocumented in source.
- hasLength (from std.range)
public
import std.range : empty, front, popFront, ElementEncodingType, hasLength;
Undocumented in source.
- isDynamicArray (from std.traits)
public
import std.traits : Unqual, hasElaborateDestructor, hasIndirections, isDynamicArray, isSafe;
Undocumented in source.
- isSafe (from std.traits)
public
import std.traits : Unqual, hasElaborateDestructor, hasIndirections, isDynamicArray, isSafe;
Undocumented in source.
- move (from core.lifetime)
public
import core.lifetime : emplace, forward, move;
Undocumented in source.
- popFront (from std.range)
public
import std.range : empty, front, popFront, ElementEncodingType, hasLength;
Undocumented in source.
import std.range : only;
import std.algorithm : map, equal;
static struct Foo{
int i;
string str;
}
List!(Foo) list;
assert(list.empty);
list.append(Foo(1, "A"));
assert(list.length == 1);
list.append(only(Foo(2, "B"), Foo(3, "C")));
assert(list.length == 3);
list.emplaceBack(4, "D");
assert(list.length == 4);
list = List!(Foo).build(Foo(-1, "X"), Foo(-2, "Y"));
assert(equal(list[].map!(e => e.str), only("X", "Y")));
list.release();
assert(list.length == 0);
List is a container that supports constant time insertion and removal of elements from anywhere in the container.
Fast random access is not supported. It is usually implemented as a linked list
Template parameters:
_Type = element type.
_Allocator = Type of the allocator object used to define the storage allocation model. By default DefaultAllocator is used.
_supportGC
_bidirectional