On Wednesday, 9 May 2018 at 14:36:38 UTC, Per Nordlöw wrote:
On Wednesday, 9 May 2018 at 14:34:02 UTC, Per Nordlöw wrote:
On Wednesday, 9 May 2018 at 14:20:41 UTC, Per Nordlöw wrote:
If so, we can temporarily modify the trait to exclude the last `void*` member of the `S.tuple`. Given that it's always added as the last member.

Also note that

    pragma(msg, __traits(isDisabled, S.this(this)));

fails to compile as

    Error: identifier expected following `.`, not `this`

Ahh, but both

    pragma(msg, __traits(isDisabled, S.__postblit));
    pragma(msg, __traits(isDisabled, S.__xpostblit));

prints true for a struct with `@disable this(this);`

Which one should I pick to check if last element of `S.tupleof` should be discarded?

Managed to put together the hack

private template mustAddGCRangeOfStructOrUnion(T)
if (is(T == struct) ||
    is(T == union))
{
    import std.traits : hasUDA;
    import std.meta : anySatisfy;
    static if (__traits(hasMember, T, "__postblit"))
    {
        static if (__traits(isDisabled, T.__postblit))
        {
enum mustAddGCRangeOfStructOrUnion = anySatisfy!(mustAddGCRangeOfMember, T.tupleof[0 .. $ - 1]);
        }
        else
        {
enum mustAddGCRangeOfStructOrUnion = anySatisfy!(mustAddGCRangeOfMember, T.tupleof);
        }
    }
    else
    {
enum mustAddGCRangeOfStructOrUnion = anySatisfy!(mustAddGCRangeOfMember, T.tupleof);
    }
}

defined here

https://github.com/nordlow/phobos-next/blob/master/src/gc_traits.d#L81

Destroy.

Reply via email to