Nameless Static Array

2014-06-12 Thread Taylor Hillegeist via Digitalmars-d-learn
So, Lately I have been avoiding the NEW keyword. I have recently given up static allocation of classes using CTFE. I guess they must be const or immutable? So naturally i can do most of what i need to with structs. They are statically allocated no NEW necessary. But without the NEW strategy.

Re: Nameless Static Array

2014-06-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 12 June 2014 at 15:58:25 UTC, Taylor Hillegeist wrote: But without the NEW strategy. I must allocate static arrays and set them to a pointer in my struct. Not too big of deal really. Have you considered just making the buffer a struct member?

Re: Nameless Static Array

2014-06-12 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 12 June 2014 at 16:02:18 UTC, Adam D. Ruppe wrote: On Thursday, 12 June 2014 at 15:58:25 UTC, Taylor Hillegeist wrote: But without the NEW strategy. I must allocate static arrays and set them to a pointer in my struct. Not too big of deal really. Have you considered just making

Re: Nameless Static Array

2014-06-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 12 June 2014 at 16:08:49 UTC, Taylor Hillegeist wrote: I am considering having different sized arrays for the buffer. I just figured that meant having different structs with various sizes. You might be able to do it with a templated struct and alias this. Check this out:

Re: Nameless Static Array

2014-06-12 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 12 June 2014 at 15:58:25 UTC, Taylor Hillegeist wrote: So, Lately I have been avoiding the NEW keyword. Why? Is malloc OK? I have recently given up static allocation of classes using CTFE. I guess they must be const or immutable? Funny, because you *are* allowed to default