[Issue 15721] std.experimental.allocator dispose on interface

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 25 21:52:59 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15721

--- Comment #2 from b2.temp at gmx.com ---
I think this is safe to change dispose to:

void dispose(A, T)(auto ref A alloc, T p)
if (is(T == class) || is(T == interface))
{
    if (!p) return;
    auto support = (cast(void*) cast(Object) p)[0 .. typeid(p).init.length];
    destroy(p);
    alloc.deallocate(support);
} 

deallocate doesn't care about the the length of initial static layout of a
class.

--


More information about the Digitalmars-d-bugs mailing list