On Monday, 20 May 2013 at 06:10:22 UTC, Kenji Hara wrote:
I know at least two cases which T.init is commonly used.
1. Inside predicate template for type T.
template isSomething(T) {
enum isSomething = is(typeof({
//T t1; // not good if T is nested struct, or has
@disable this()
//T t2 = void; auto x = t2; // not good if T is
non-mutable type
T t = T.init; // avoid default construct check
...use t...
}));
}
2. Some library utilities that treats object state directly,
e.g.
std.conv.emplace
Kenji Hara
I see. But unfortunately this undermines @disable and defeats
arguments for using it. @disable is another feature (like ref and
@safe) which cannot be fixed be design.