On Tuesday, 7 May 2013 at 10:29:44 UTC, Namal wrote:
Hello,

I am new to D. According to that power of 2 rule I want to
reserve 2 sized chunks to my array, But how do I do that in a
struct? Say:

struct Stack(int){

int a[];


}


"2 sized chunks"?

Perhaps you want something like this:

struct Stack{
        int a[];
        this(size_t r) {
                a.reserve(r);
        }
}

void main() {
        auto s = Stack(2);
}

Reply via email to