On Saturday, 20 May 2017 at 10:48:54 UTC, Gary Willoughby wrote:
Looks like you would want to use emplace [0] here.

        public this(int n)
        {
                this._data = (cast(Foo*) calloc(n, Foo.sizeof))[0 .. n];

                foreach(ref element; this._data)
                {
                        auto tmp = Foo(1);
                        element = tmp;
                }
        }

Cheers,
Eduard

[0] - https://dlang.org/phobos/std_conv.html#.emplace.3

Reply via email to