Difficulties with std.variant.Algebraic
bearophile
bearophileHUGS at lycos.com
Thu Jul 11 06:29:21 PDT 2013
> Nullable!(int, 0) unreliable2(in int val) pure nothrow {
> if (val == 0) {
> return typeof(return)();
> } else {
> return typeof(return)(val);
> }
> }
Sorry, I meant:
import std.typecons;
Nullable!int unreliable1(in int val) pure nothrow {
if (val == 0) {
return typeof(return)();
} else {
return typeof(return)(val);
}
}
Nullable!(int, 0) unreliable2(in int val) pure nothrow {
return typeof(return)(val);
}
void main() {
auto nx1 = unreliable1(10);
auto nx2 = unreliable2(10);
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list