The OpenD Programming Language

CollectionStyle

Collection styles

Values

ValueMeaning
none

Uninitialized style

block

Block style

flow

Flow style

Examples

mir.conv: to extension.

import mir.conv: to;
import mir.small_string;
alias S = SmallString!32;

// Floating-point numbers are formatted to
// the shortest precise exponential notation.
assert(123.0.to!S == "123.0");
assert(123.to!(immutable S) == "123");
assert(true.to!S == "true");
assert(true.to!string == "true");

assert((cast(S)"str")[] == "str");

mir.conv: to extension.

import mir.conv: to;
import mir.small_string;
alias S = SmallString!32;

auto str = S("str");
assert(str.to!(const(char)[]) == "str"); // GC allocated result
assert(str.to!(char[]) == "str"); // GC allocated result

ditto

import mir.conv: to;
import mir.small_string;
alias S = SmallString!32;

// Floating-point numbers are formatted to
// the shortest precise exponential notation.
assert(123.0.to!string == "123.0");
assert(123.to!(char[]) == "123");

assert(S("str").to!string == "str"); // GC allocated result

Meta