|
|
| version 1.97, 2024/10/07 23:46:24 | version 1.99, 2024/10/26 18:53:37 |
|---|---|
| Line 108 public: | Line 108 public: |
| } | } |
| /// append other Array portion to this one. starting from offset | /// append other Array portion to this one. starting from offset |
| Array& append(const Array& src, | void append(const Array& src, size_t offset=0, size_t limit=ARRAY_OPTION_LIMIT_ALL) { //< zero limit means 'nothing' |
| size_t offset=0, | |
| size_t limit=ARRAY_OPTION_LIMIT_ALL) { //< zero limit means 'nothing' | |
| size_t src_count=src.count(); | size_t src_count=src.count(); |
| // skip tivials | // skip tivials |
| if(!src_count || !limit || offset>=src_count) | if(!src_count || !limit || offset>=src_count) |
| return *this; | return; |
| // max(limit) | // max(limit) |
| size_t m=src_count-offset; | size_t m=src_count-offset; |
| // fix limit | // fix limit |
| Line 123 public: | Line 120 public: |
| limit=m; | limit=m; |
| fit(fsize-1+limit); | fit(fsize-1+limit); |
| memcpy(felements+fsize, src.felements+offset, limit * sizeof(T)); | |
| T* from=&src.felements[offset]; | |
| T* to=&felements[fsize]; | |
| for(T* from_end=from+limit; from<from_end;) | |
| *to++=*from++; | |
| fsize+=limit; | fsize+=limit; |
| return *this; | |
| } | } |
| /// get index-element | /// get index-element |
| Line 226 protected: | Line 218 protected: |
| inline void fit(size_t index){ | inline void fit(size_t index){ |
| if(index >= fallocated) | if(index >= fallocated) |
| resize(max(this->fallocated + this->fallocated/4, index+1)); | resize(max(fallocated+fallocated/4, index+1)); |
| } | } |
| void resize(size_t asize) { | void resize(size_t asize) { |