my ideas for array operations

dennis luehring dl.soluz at gmx.net
Mon Oct 8 00:03:55 PDT 2007


> It is worth pondering about efficiency though. Most especially when it
> comes to concatenation. That is:
> 
> string s = cat(a,b,c,d,e,f,g,h);
> 
> ought to be more efficient than
> 
> string s = a~b~c~d~e~f~g~h;
> 
> because the former could, in principle, require only one allocation,
> wheras the latter needs seven.

only if the compiler don't understand whats going on
who says that a compiler need to seperate each concatenate in a single 
operation? its the compilers job to use an efficent way

do you think that a array slice works the same?

int b[5] = [1,2,3,4,5]
int t[3] = b[1..3]

t[0] = &b[1]
t[1] = &b[2]

btw: i understand that my idea just adress 2% of the array operations 
needs - so i rejeced it myself (clean brain again)

ciao dennis






More information about the Digitalmars-d mailing list