davidl schrieb:
The cons/pros of this proposal:
Cons:
ungly syntax da!(int)(3) is really worse than int[3];
slow down the compiling process
Yep, you say it.
Also Tuple!(int, float) is accused as ugly
Can't understand what's so ugly about that. int~float is nothing better.
在 Thu, 02 Apr 2009 12:08:39 +0800,davidl 写道:
Something like following can substitute dynamic array:
struct da(T){
T* ptr;
int len, capacity;
T opIndex(int i){}
int length(){ return len;}
void length(int len){ // do allocation}
this(int i){ //allocate memory for ptr
Something like following can substitute dynamic array:
struct da(T){
T* ptr;
int len, capacity;
T opIndex(int i){}
int length(){ return len;}
void length(int len){ // do allocation}
this(int i){ //allocate memory for ptr }
this(){ // do nothing}
da!(T) opCat(T* a){