Sean Kelly skrev:
> Perhaps D arrays simply need a reserve property?
Something like this ought to work:
template reserve(ArrTy,IntTy) {
void reserve(inout ArrTy a, IntTy size) {
if (size > a.length) {
size_t old_length = a.length;
a.length = size;
a = a[0..old_length];
}
}
}
usage:
arr.reserve(1000);
/Oskar