| 1 |
module imports.a15079; |
| 2 |
|
| 3 |
Vector!string parseAlgorithmName() |
| 4 |
{ |
| 5 |
assert(0); |
| 6 |
} |
| 7 |
|
| 8 |
struct Vector(ALLOC) |
| 9 |
{ |
| 10 |
@disable this(this); |
| 11 |
|
| 12 |
RefCounted!(Vector, ALLOC) dupr() |
| 13 |
{ |
| 14 |
assert(0); |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
struct RefCounted(T, ALLOC) |
| 19 |
{ |
| 20 |
~this() |
| 21 |
{ |
| 22 |
T* objc; |
| 23 |
.destroy(*objc); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
// ---- |
| 28 |
|
| 29 |
void _destructRecurse(S)(ref S s) |
| 30 |
if (is(S == struct)) |
| 31 |
{ |
| 32 |
static if (__traits(hasMember, S, "__xdtor") && |
| 33 |
__traits(isSame, S, __traits(parent, s.__xdtor))) |
| 34 |
{ |
| 35 |
s.__xdtor(); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
void destroy(T)(ref T obj) if (is(T == struct)) |
| 40 |
{ |
| 41 |
_destructRecurse(obj); |
| 42 |
() @trusted { |
| 43 |
auto buf = (cast(ubyte*) &obj)[0 .. T.sizeof]; |
| 44 |
const init = cast(ubyte[]) __traits(initSymbol, T); |
| 45 |
if (init.ptr is null) // null ptr means initialize to 0s |
| 46 |
buf[] = 0; |
| 47 |
else |
| 48 |
buf[] = init[]; |
| 49 |
} (); |
| 50 |
} |