On Wednesday, 26 April 2017 at 13:38:59 UTC, Steven Schveighoffer wrote:

    ~this()
    {
        data.destroy();
    }

Don't do this. It's not a good idea, since data could be invalid at this point. In this case, destroy does nothing (it just sets the array to null), so I would just leave the destructor out of it.

Yeah, sorry, got carried away. Postblit would've been enough for enabling destructive move.

If you want to duplicate const data, but just shallow-copy mutable data, you are correct in that you need two separate constructors, and inout doesn't come into play.

That's the thing, this is more about "need" than "want". As far as I understood, Manu is talking about these ctors from the C++ perspective, where the copy constructor takes const&. And the problem for those who come from C++ would be that in D it doesn't work that way, at least not universally.

Reply via email to