The OpenD Programming Language

SmallArray

Members

Structs

SmallArray
struct SmallArray

Examples

SmallArray!(char, 16) s16;
assert(s16.empty);

auto s8 = SmallArray!(char, 8)("Hellow!!");
assert(!s8.empty);
assert(s8 == "Hellow!!");

s16 = s8;
assert(s16 == "Hellow!!");
s16[7] = '@';
s8 = null;
assert(s8.empty);
assert(s8 == null);
s8 = s16;
assert(s8 == "Hellow!@");

auto s8_2 = s8;
assert(s8_2 == "Hellow!@");
assert(s8_2 == s8);

assert(s8 < "Hey");
assert(s8 > "Hellow!");

assert(s8.opCmp("Hey") < 0);
assert(s8.opCmp(s8) == 0);

Concatenation

auto a = SmallArray!(char, 16)("asdf");
a ~= " ";
auto b = a ~ "qwerty";
static assert(is(typeof(b) == SmallArray!(char, 16)));
assert(b == "asdf qwerty");
b.put('!');
b.put("!");
assert(b == "asdf qwerty!!");

Meta