tester

Undocumented in source. Be warned that the author may not have intended to support it.
static
void
tester
(
Ordering ordering
bool supportGC
alias less
)
()

Examples

disabled copying

alias E = ubyte;
alias A = Array!(E, Assignment.disabled, Ordering.unsorted, false, size_t, "a < b");
A a;
immutable n = ubyte.max;
size_t i = 0;
foreach (ubyte e; 0 .. n)
{
    a ~= e;
    // assert(a.back == e.to!E);
    assert(a.length == i + 1);
    ++i;
}
const b = a.dup;
static assert(is(typeof(a) == Unqual!(typeof(b))));
assert(b.length == a.length);
assert(a !is b);
assert(a == b);

disabled copying

alias E = string;

alias A = Array!(E, Assignment.disabled, Ordering.unsorted, false, size_t, "a < b");
A a;
immutable n = 100_000;
size_t i = 0;
foreach (const ref e; 0 .. n)
{
    a ~= e.to!E;
    // assert(a.back == e.to!E);
    assert(a.length == i + 1);
    ++i;
}
const b = a.dup;
static assert(is(typeof(a) == Unqual!(typeof(b))));
assert(b.length == a.length);
assert(a !is b);
assert(a == b);

disabled copying

alias E = string;
alias A = Array!(E, Assignment.disabled, Ordering.unsorted, false, size_t, "a < b");
A a;
immutable n = 100_000;
size_t i = 0;
foreach (const ref e; 0 .. n)
{
    a ~= e.to!E;
    assert(a.length == i + 1);
    ++i;
}
const b = a.dup;
static assert(is(typeof(a) == Unqual!(typeof(b))));
assert(a[] == b[]);

disabled copying

import std.traits : isAssignable;

alias E = string;

alias A = Array!E;
static assert(!__traits(isCopyable, A));

alias CA = CopyingArray!E;
static assert(__traits(isCopyable, CA));

// import std.traits : isRvalueAssignable, isLvalueAssignable;
// static assert(isRvalueAssignable!(A));
// static assert(isLvalueAssignable!(A));

static assert(isAssignable!(A));

// import std.range.primitives : hasSlicing;
// TODO: make this evaluate to `true`
// static assert(hasSlicing!A);

alias AA = Array!A;

AA aa;
A a;
a ~= "string";
aa ~= A.init;

assert(aa == aa);
assert(AA.withLength(3) == AA.withLength(3));
assert(AA.withCapacity(3) == AA.withCapacity(3));
assert(AA.withLength(3).length == 3);
assert(aa != AA.init);
alias E = int;
alias A = Array!E;
A a;
import std.range : iota;
import std.container.util : make;
foreach (n; 0 .. 100)
{
    const e = iota(0, n).make!Array;
    assert(e[].equal(iota(0, n)));
}

Meta