Type.opBinary

Undocumented in source. Be warned that the author may not have intended to support it.
struct Type(T)
const pure nothrow @safe @nogc
opBinary
(
string op
U
)
if (
op == "+" ||
op == "*"
)

Examples

import std.typecons : Tuple;
import std.variant : Algebraic;

enum t1 = type!int;
enum t2 = type!double;

enum t3 = t1 + t2;
static assert (t3 == type!(Algebraic!(int, double)));

enum t4 = t1 * t2;
static assert (t4 == type!(Tuple!(int, double)));

enum t5 = (t1 + t2) * t1 + t4;
static assert (t5 ==
    type!(
        Algebraic!(
            Tuple!(
                Algebraic!(int, double),
                int
            ),
            Tuple!(int, double)
        )
    )
);

Meta