08-27-2007, 08:04 PM
Don't use pointer-based arrays of str type, because it is too difficult, because you must not only move memory but also properly clear str elements. This is example:
There are 7 lines of code to remove str element. Unless you put it in a function.
;create array
str* p._new(10)
int i
for i 0 p._len
,p[i].from("line" i)
;remove element 3
int rem=3
int nelementstomove=p._len-rem-1
if(nelementstomove)
,p[rem].all
,memmove &p[rem] &p[rem+1] nelementstomove*sizeof(str)
,p[p._len-1].lpstr=0
p._resize(p._len-1)
;results
out
for i 0 p._len
,out p[i]
p._delete
There are 7 lines of code to remove str element. Unless you put it in a function.