I've been working on a pull request and came up with something like this:

private void initialize(A...)(auto ref A args)
{
    auto m = cast(void* function(size_t size) pure)&malloc;
    _store = cast(Impl*) enforce(m(Impl.sizeof));
auto r = cast(void function(in void* p, size_t sz) nothrow pure)&GC.addRange;
    static if (hasIndirections!T)
        r(&_store._payload, T.sizeof);
    emplace(&_store._payload, args);
    _store._count = 1;
}

The purity of "emplace" depends on the purity of the ctor called. I'm not sure how to fix that.

Reply via email to