On Wednesday, November 21, 2012 00:30:16 Namespace wrote: > Yeah, but it's inconvenient to use a struct instead of a built in > solution. ;)
But if the built-in solution doesn't do what you want, then that's what you have to do. And the only built-in solutions are to either have a static array where you know its length at compile time or to use dynamic arrays, whose memory would be managed by the GC and which would allocate extra memory beyond the end of the array in order to make appending efficient. If either of those are fine, then there you go. But if they're not fine, then you need to find another solution. std.container.Array is closer to what you seem to want, but it would also allocate extra memory (it should have deterministic destruction though, since it uses malloc and free internally). To do exactly what you want would require creating your own type. - Jonathan M Davis