xxxxxxxxxx
struct W(T) {
const T value;
this(U : T)(auto ref const U value) {
this.value = value;
}
}
auto defined(T)(auto ref const T value) {
return W!T(value);
}
auto undefined(T)() {
return W!T();
}
void main() {
auto a = defined("hello");
auto b = undefined!string;
static assert(is(typeof(a) == W!string));
static assert(is(typeof(b) == W!string));
static class C {}
auto c = defined(cast(immutable C)(new C));
auto d = [undefined!string, defined("hello")];
}