List.this - multiple declarations
Function List.this
Constructs a empty List
with allocator a
.
Examples
{
List!(int) list = DefaultAllocator .init;
assert(list .empty);
}
Function List.this
Constructs a empty List
this
(
typeof(null) nil
) scope pure nothrow @nogc scope @safe;
Examples
{
List!(int) list = null;
assert(list .empty);
}
Function List.this
Constructs a List
object from other list.
this(Rhs, This)
(
auto scope ref Rhs rhs
) scope scope
if (isList!Rhs && isConstructable!(Rhs, This) && (isRef!Rhs || !is(immutable(This) == immutable(Rhs))));
Parameters
allocator
optional allocator parameter.
Examples
{
List!(int) list = List!(int) .build(1, 2);
assert(list == [1, 2]);
}
{
auto tmp = List!(int) .build(1, 2);
List!(int) list = tmp;
assert(list == [1, 2]);
}
{
List!(int) list = List!(int) .build(1, 2);
assert(list == [1, 2]);
}
{
auto tmp = List!(int) .build(1, 2);
List!(int) list = tmp;
assert(list == [1, 2]);
}
Function List.this
Forward constructor.
this(Rhs, This)
(
auto scope ref Rhs rhs,
Forward
) scope scope
if (isList!Rhs && isConstructable!(Rhs, This));
Function List.this
Constructs a bidirectional List
object from range of elements.
this(R, This)
(
R range
) scope scope
if (isBtlInputRange!R && is(ElementEncodingType!R : GetElementType!This));
this(R, This)
(
R range,
List . AllocatorType allcoator
) return
if (isBtlInputRange!R && is(ElementEncodingType!R : GetElementType!This));
Parameters
range
input reange of ElementType
elements.
allocator
optional allocator parameter.
Examples
import std .range : iota;
{
List!(int) list = iota(0, 5);
assert(list == [0, 1, 2, 3, 4]);
}