Open wilzbach opened 7 years ago
Biggest problem: Variant
isn't @safe
struct SafeVariantN(size_t maxDataSize, AllowedTypesParam...)
{
VariantN!(maxDataSize, AllowedTypesParam) _variant;
alias _variant this;
this(T)(T value) @trusted
{
static assert(_variant.allowed!(T), "Cannot store a " ~ T.stringof
~ " in a " ~ VariantN.stringof);
_variant.opAssign(value);
}
~this() @trusted {
_variant.destroy();
}
this(this) @trusted {}
SafeVariantN opAssign(T)(T rhs) @trusted
{
static if (!is(T == typeof(null)))
_variant = _variant.opAssign(rhs._variant);
return this;
}
}
alias SafeVariant = SafeVariantN!(maxSize!(creal, char[], void delegate()));
...
else static if (hasMember!(T, "_variant"))
{
static if (typeof(T.init._variant).stringof[0..8] == "VariantN")
enum isVariantN = true;
else
enum isVariantN = false;
}
...
import ddb.db : Variant = SafeVariant;
Fix the holes in
@trusted
.