Hi,

I have a struct with two immutable members, and I want to make an array of them. How do I to this? I'm using allocators for this.

string[] paths;

struct FileDesc {
    immutable string path;
    immutable uint index;
}

_fileDesc = /*something*/;

You can't use alloc.makeArray because it requires a range with which to initialize the array, and while I can produce an array of paths, I don't know how to merge both a range of paths and indices. Lockstep doesn't work.

I also tried using emplace and an allocated byte array, but it gave me random values and was (I think) unnecessarily complicated. What am I missing?

Reply via email to