8 #ifndef INCL_evo_list_h 9 #define INCL_evo_list_h 17 #pragma warning(disable:4458) 239 template<
class T,
class TSize=SizeT>
277 Edit() : ptr(NULL), size(0), header(NULL)
288 if (header != NULL) {
307 Size
write(
const ListBaseType& src, Size start=0, Size count=
ALL) {
308 if (start < src.size_ && count > 0) {
309 const Size maxcount = src.
size_ - start;
310 if (count > maxcount)
331 assert( data != NULL );
343 #if EVO_LIST_OPT_REFTERM 355 #if EVO_LIST_OPT_REFTERM 368 #if EVO_LIST_OPT_REFTERM 384 #if EVO_LIST_OPT_REFTERM 399 #if EVO_LIST_OPT_REFTERM 402 if (data.
data_ == NULL) {
404 }
else if (index < data.
size_) {
405 const Size max_size = data.
size_ - index;
425 #if EVO_LIST_OPT_REFTERM 428 if (data == NULL || data->
data_ == NULL) {
430 }
else if (index < data->
size_) {
431 const Size max_size = data->
size_ - index;
451 #if EVO_LIST_OPT_REFTERM 465 #if EVO_LIST_OPT_REFTERM 468 if (data.
ptr_ != NULL)
472 #if defined(EVO_CPP11) 478 modAppend(NULL, (Size)init.size());
480 for (
auto& val : init)
488 ::memcpy(
this, &src,
sizeof(ListType));
489 ::memset(&src, 0,
sizeof(ListType));
499 ::memcpy(
this, &src,
sizeof(ListType));
500 ::memset(&src, 0,
sizeof(ListType));
523 {
return set(
data); }
532 if (data.
data_ == NULL)
534 else if (data.
size_ > 0)
593 #if !EVO_LIST_OPT_LAZYBUF 599 #if EVO_LIST_OPT_REFTERM 603 #if !EVO_LIST_OPT_LAZYBUF 631 {
ref(data,
size);
return *
this; }
640 if (data.ptr_ == NULL)
653 ListType&
set(
const ListType&
data)
654 {
ref(data);
return *
this; }
665 {
ref(data, index, size);
return *
this; }
675 ListType&
set(
const ListBaseType&
data, Key index=0, Key size=
ALL) {
676 if (data.data_ == NULL)
678 else if (index < data.size_) {
679 const Size max_size = data.size_ - index;
683 copy(data.data_+index, size);
700 ListType&
set2(
const ListType& data, Key index1, Key index2)
701 {
ref(data, index1, (index1<index2?index2-index1:0));
return *
this; }
711 ListType&
set2(
const ListBaseType& data, Key index1, Key index2) {
712 if (data.
data_ == NULL) {
715 if (index2 > data.
size_)
717 if (index1 < data.size_ && index2 > index1)
718 copy(data.
data_+index1, (index2-index1));
746 {
return (
data_ == NULL); }
754 {
return (
size_ == 0); }
796 { assert( index <
size_ );
return data_[index]; }
804 const Item&
item(Key index)
const 805 { assert( index <
size_ );
return data_[index]; }
845 result = (data.
data_ == NULL ? 0 : -1);
846 else if (data.
data_ == NULL)
860 result = (data.
data_ == NULL);
877 result = (data.
data_ != NULL);
903 bool starts(
const Item* items, Size size)
const 912 bool starts(
const ListBaseType& items)
const 931 bool ends(
const Item* items, Size size)
const 940 bool ends(
const ListBaseType& items)
const 952 {
return Iter(*
this); }
972 {
return IterM(*
this); }
981 {
return Iter(*
this); }
1016 for (; start <
end; ++start)
1017 if (
data_[start] == item)
1055 for (; start <
end; ++start)
1056 for (j=0; j<count; ++j)
1057 if (
data_[start] == items[j])
1079 for (j=0; j < count; ++j)
1093 bool result =
false;
1094 for (Key i=0; i <
size_; ++i)
1095 if (
data_[i] == item)
1096 { result =
true;
break; }
1108 bool result =
false;
1109 if (size > 0 &&
size_ >= size) {
1111 for (Key i=0; i <=
end; ++i)
1113 { result =
true;
break; }
1125 bool result =
false;
1128 for (Key i=0; i <=
end; ++i)
1130 { result =
true;
break; }
1150 template<
class T1,
class T2>
1151 bool splitat(Key index, T1& left, T2& right)
const {
1153 if (index >=
size_) {
1158 left.set(*
this, 0, index);
1159 right.set(*
this, index+1,
ALL);
1179 if (index >=
size_) {
1183 left.set(*
this, 0, index);
1205 if (index >=
size_) {
1209 right.set(*
this, index+1,
ALL);
1226 if (index >=
size_) {
1246 if (index >=
size_) {
1250 right.set(*
this, index+1,
ALL);
1266 if (index >=
size_) {
1287 if (index >=
size_) {
1292 left.set(*
this, 0, index);
1329 #if EVO_LIST_OPT_REFTERM 1330 terminated_ =
false;
1345 #if EVO_LIST_OPT_REFTERM 1346 terminated_ =
false;
1362 if (index >=
size_) {
1384 if (index >=
size_) {
1387 #if EVO_LIST_OPT_REFTERM 1388 terminated_ =
false;
1396 #if EVO_LIST_OPT_REFTERM 1397 terminated_ =
false;
1401 }
else if (size <
size_) {
1403 #if EVO_LIST_OPT_REFTERM 1404 terminated_ =
false;
1419 {
return slice(index1, (index1 < index2 ? index2-index1 : 0)); }
1433 assert(
data_ != NULL );
1446 unsliceBuffer(
size_);
1448 #if EVO_LIST_OPT_REFTERM 1449 terminated_ =
false;
1517 #if !EVO_LIST_OPT_LAZYBUF 1522 #if EVO_LIST_OPT_LAZYBUF 1530 #if EVO_LIST_OPT_REFTERM 1531 terminated_ =
false;
1553 unsliceBuffer(
size_);
1560 #if EVO_LIST_OPT_REFTERM 1561 terminated_ =
false;
1579 #if EVO_LIST_OPT_REFTERM 1580 terminated_ =
false;
1596 assert(
data_ != NULL );
1601 #if EVO_LIST_OPT_REFTERM 1602 terminated_ =
false;
1610 #if EVO_LIST_OPT_REFTERM 1611 terminated_ =
false;
1615 #if EVO_LIST_OPT_LAZYBUF 1623 }
else if (
data_ != NULL)
1625 #if EVO_LIST_OPT_REFTERM 1626 terminated_ =
false;
1629 }
else if (
data_ != NULL)
1632 assert(
size_ <= size );
1634 #if !EVO_LIST_OPT_LAZYBUF 1671 else if (
size_ > max) {
1673 #if EVO_LIST_OPT_REFTERM 1674 terminated_ =
false;
1703 ListType&
reserve(Size size,
bool prefer_realloc=
false) {
1706 #if EVO_LIST_OPT_LAZYBUF 1717 #if EVO_LIST_OPT_REFTERM 1718 terminated_ =
false;
1745 assert(
data_ >=
buf_.
ptr && data_ <= buf_.ptr+buf_.header->used );
1766 #if EVO_LIST_OPT_REFTERM 1767 terminated_ =
false;
1785 #if EVO_LIST_OPT_LAZYBUF 1796 #if EVO_LIST_OPT_REFTERM 1797 terminated_ =
false;
1826 assert(
data_ != NULL );
1830 #if EVO_LIST_OPT_REFTERM 1831 terminated_ =
false;
1856 #if EVO_LIST_OPT_LAZYBUF 1865 if (size <=
size_) {
1904 assert(
data_ != NULL );
1913 #if EVO_LIST_OPT_REFTERM 1914 terminated_ =
false;
1929 ListType&
copy(
const Item* data, Size size) {
1958 assert( data != NULL );
1966 #if EVO_LIST_OPT_REFTERM 1967 terminated_ =
false;
1979 ListType&
copy(
const ListBaseType& data) {
1980 if (data.
data_ == NULL)
2006 if (minsize >
size_)
2019 ListType&
add(
const Item* data, Size size)
2020 { modAppend(data, size);
return *
this; }
2029 ListType&
add(
const ListBaseType& data)
2030 { modAppend(data.
data_, data.
size_);
return *
this; }
2039 ListType&
add(
const Item& data)
2040 { modAppend(&data, 1);
return *
this; }
2055 {
return add(data); }
2070 {
return add(data); }
2126 { modPrepend(data, size);
return *
this; }
2136 { modPrepend(data.
data_, data.
size_);
return *
this; }
2145 { modPrepend(&data, 1);
return *
this; }
2163 Size
insert(Key index,
const Item* data, Size size)
2164 {
return modInsert(index, data, size); }
2171 Size
insert(Key index,
const ListBaseType& data)
2172 {
return modInsert(index, data.
data_, data.
size_); }
2180 {
return modInsert(index, &data, 1); }
2189 Size
remove(Key index, Size size=1)
2190 {
return modRemove(index, size); }
2203 if (index <
size_) {
2205 modRemove(index, 1);
2222 const Size index =
size_ - 1;
2224 modRemove(index, 1);
2297 const Size newsize = index +
size;
2298 if (newsize >
size_)
2316 ListType&
replace(Key index, Size rsize,
const Item* data, Size size) {
2318 modInsert(index, data, size);
2320 modRemove(index, rsize);
2321 else if (index >=
size_)
2322 modAppend(data, size);
2324 modReplace(index, rsize, data, size);
2339 if (index <
size_) {
2342 if (index != dest) {
2344 char buf[
sizeof(T)];
2345 memcpy(buf,
data_+index,
sizeof(T));
2348 memmove(
data_+dest+1,
data_+dest, (index-dest)*
sizeof(T));
2351 memmove(
data_+index,
data_+index+1, (dest-index)*
sizeof(T));
2352 memcpy(
data_+dest, buf,
sizeof(T));
2365 Size
move(Key dest, ListType& src, Key srcindex=0, Size size=
ALL) {
2366 const Size maxsize = (srcindex < src.
size_ ? src.
size_-srcindex : 0);
2374 #if EVO_LIST_OPT_LAZYBUF 2378 assert(
size_ > 0 );
2382 const Size nextindex = dest +
size;
2383 if (nextindex < newused)
2388 #if EVO_LIST_OPT_REFTERM 2389 terminated_ =
false;
2402 assert(
data_ >=
buf_.
ptr && data_ <= buf_.ptr+buf_.header->used );
2417 if (newbufsize <= newused)
2418 newbufsize = newused + 1;
2420 T* newbuf =
buf_.
memalloc(newbufsize, newused, newheader);
2422 memcpy(newbuf,
data_,
sizeof(T)*dest);
2423 const Size tailsize =
size_ - dest;
2425 memcpy(newbuf+dest+size,
data_+dest,
sizeof(T)*tailsize);
2433 if (size > offset) {
2441 const Size tailsize =
size_ - dest;
2443 memmove(
data_+dest+size,
data_+dest+offset,
sizeof(T)*tailsize);
2447 const Size newoffset = offset -
size;
2465 const Size nextindex = dest +
size;
2466 if (nextindex < newheader->used)
2471 #if EVO_LIST_OPT_REFTERM 2472 terminated_ =
false;
2481 memcpy(
data_+dest, src.
data_+srcindex,
sizeof(T)*size);
2482 src.modRemove(srcindex, size,
false);
2485 meminit(
data_+dest, src.
data_+srcindex, size);
2486 src.modRemove(srcindex, size,
true);
2497 void swap(Key index1, Key index2) {
2498 if (index1 != index2 && index1 <
size_ && index2 <
size_) {
2510 { EVO_IMPL_CONTAINER_SWAP(
this, &list, ThisType); }
2522 char temp[
sizeof(T)];
2525 while (left < right) {
2526 memcpy(temp, left,
sizeof(T));
2527 memcpy(left, right,
sizeof(T));
2528 memcpy(right, temp,
sizeof(T));
2559 #if EVO_LIST_OPT_LAZYBUF 2568 if (size <=
size_) {
2607 assert(
data_ != NULL );
2616 #if EVO_LIST_OPT_REFTERM 2617 terminated_ =
false;
2649 assert( minsize > 0 );
2652 #if EVO_LIST_OPT_LAZYBUF 2698 assert( edit.ptr != NULL );
2699 if (edit.header == NULL) {
2769 assert( addsize > 0 );
2797 assert( index <
size_ );
2798 return data_[index];
2825 { modAppend(NULL, size); }
2835 { modPrepend(NULL, size); }
2847 {
return modInsert(index, NULL, size); }
2858 { modRemove(index, size,
false); }
2869 char buf[
sizeof(T)];
2870 memcpy(buf,
data_+index1,
sizeof(T));
2871 memcpy(
data_+index1,
data_+index2,
sizeof(T));
2872 memcpy(
data_+index2, buf,
sizeof(T));
2885 #if EVO_UNIT_TEST_MODE 2886 bool utTerminated()
const {
2887 #if EVO_LIST_OPT_REFTERM 2895 const Item* utBuffer()
const 2897 void utSetEmptyBuffer(
bool setempty,
size_t size=1) {
2906 void utSetUnusedBuffer(
bool setempty,
size_t size=1) {
2916 void utSetBufPtr() {
2925 void iterInitMutable()
2927 const IterItem* iterFirst(IterKey& key)
const {
2928 const IterItem* result;
2938 const IterItem* iterNext(IterKey& key)
const {
2939 const IterItem* result = NULL;
2942 result =
data_ + key;
2948 const IterItem* iterNext(Size count, IterKey& key)
const {
2949 const Item* result = NULL;
2951 if ( (key+=count) <
size_ )
2952 result =
data_ + key;
2958 const IterItem* iterLast(IterKey& key)
const {
2959 const IterItem* result;
2962 result =
data_ + key;
2969 const IterItem* iterPrev(IterKey& key)
const {
2970 const IterItem* result = NULL;
2973 result =
data_ + --key;
2979 const IterItem* iterPrev(Size count, IterKey& key)
const {
2980 const IterItem* result = NULL;
2982 if (key > 0 && count <= key)
2983 result =
data_ + (key-=count);
2989 Size iterCount()
const 2991 const IterItem* iterSet(IterKey key)
const {
2992 const IterItem* result = NULL;
2994 result =
data_ + key;
3012 Allocator* allocator;
3043 const Size bytes =
sizeof(
Header) + (size*
sizeof(T));
3045 if (allocator == NULL)
3046 header = (
Header*)::malloc(bytes);
3048 header = (
Header*)allocator->alloc(bytes);
3050 header = (
Header*)::malloc(bytes);
3052 assert( header != NULL );
3054 header->
used = used;
3056 return (T*)(header + 1);
3078 assert( (
size_t)this->header >
sizeof(
Header) );
3079 assert( this->ptr != NULL );
3081 const Size bytes =
sizeof(
Header) + (size*
sizeof(T));
3083 if (allocator == NULL)
3084 this->header = (
Header*)::realloc(this->header, bytes);
3086 this->header = (
Header*)allocator->realloc(this->header, bytes);
3088 this->header = (
Header*)::realloc(this->header, bytes);
3090 assert( this->header != NULL );
3091 this->ptr = (T*)(this->header+1);
3100 assert( (
size_t)header >
sizeof(
Header) );
3102 if (this->allocator == NULL)
3105 this->allocator->free(header);
3113 if (header != NULL && --header->
refs == 0) {
3114 if (header->
used > 0)
3126 assert( newptr != NULL );
3127 assert( newheader != NULL );
3128 assert( newptr != ptr );
3137 #if EVO_LIST_OPT_REFTERM 3144 void ref(
const ListType& data) {
3145 if (data.
data_ == NULL) {
3147 }
else if (data.
size_ == 0) {
3150 }
else if (buf_.allocator != NULL && data.
buf_.
ptr != NULL) {
3153 }
else if (data.
buf_.
ptr == NULL) {
3155 if (buf_.ptr != NULL) {
3156 assert( buf_.header != NULL );
3157 if (buf_.header->refs > 1) {
3159 --buf_.header->refs;
3164 assert( buf_.header->refs == 1 );
3165 if (buf_.header->used > 0)
3167 #if EVO_LIST_OPT_LAZYBUF 3168 buf_.header->used = 0;
3179 #if EVO_LIST_OPT_REFTERM 3180 terminated_ = data.terminated_;
3185 assert( data.
buf_.
ptr != NULL );
3189 ++buf_.header->refs;
3192 #if EVO_LIST_OPT_REFTERM 3193 terminated_ = data.terminated_;
3203 void ref(
const ListType& data, Size index, Size size) {
3204 if (data.
data_ == NULL)
3206 else if (index >= data.
size_)
3209 const Size max_size = (data.
size_ - index);
3210 if (size > max_size)
3215 }
else if (buf_.allocator != NULL && data.
buf_.
header != NULL) {
3218 }
else if (data.
buf_.
ptr == NULL) {
3220 if (buf_.ptr != NULL) {
3221 assert( buf_.header != NULL );
3222 if (buf_.header->refs > 1) {
3224 --buf_.header->refs;
3229 assert( buf_.header->refs == 1 );
3230 if (buf_.header->used > 0)
3232 #if EVO_LIST_OPT_LAZYBUF 3233 buf_.header->used = 0;
3244 #if EVO_LIST_OPT_REFTERM 3245 terminated_ = (data.terminated_ && size == max_size);
3255 #if EVO_LIST_OPT_REFTERM 3256 terminated_ = data.terminated_;
3258 ++buf_.header->refs;
3268 void ref(
const Item* data, Size size,
bool term=
false) {
3275 if (buf_.ptr != NULL) {
3276 assert( buf_.header != NULL );
3277 if (buf_.header->refs > 1) {
3279 --buf_.header->refs;
3284 assert( buf_.header->refs == 1 );
3285 if (buf_.header->used > 0)
3287 #if EVO_LIST_OPT_LAZYBUF 3288 buf_.header->used = 0;
3299 #if EVO_LIST_OPT_REFTERM 3309 static const Size CONSERVE = (
sizeof(T) == 1 ? 1 : 0);
3316 void unsliceBuffer(Size size) {
3317 assert( buf_.header != NULL && buf_.ptr >= (T*)(buf_.header+1) );
3318 assert(
data_ >= buf_.ptr && data_ <= buf_.ptr+buf_.header->used );
3319 const Size offset = (
Size)(
data_ - buf_.ptr);
3321 const Size tailsize = buf_.header->used - size - offset;
3324 buf_.header->used -= tailsize;
3330 memmove((
void*)buf_.ptr, (
void*)(buf_.ptr+offset), size*
sizeof(T));
3332 buf_.header->used -= offset;
3340 void modAppend(
const Item* data, Size size) {
3343 if (buf_.header != NULL) {
3344 #if EVO_LIST_OPT_LAZYBUF 3345 if (buf_.ptr == NULL) {
3346 assert( buf_.header->refs == 1 );
3347 if (buf_.header->size >= newused) {
3349 buf_.ptr = (T*)(buf_.header + 1);
3352 meminit(buf_.ptr+
size_, data, size);
3353 buf_.header->used = newused;
3356 #if EVO_LIST_OPT_REFTERM 3357 terminated_ =
false;
3364 assert( buf_.ptr != NULL );
3366 if (buf_.header->refs == 1) {
3369 if (buf_.header->used > 0) {
3370 assert(
data_ >= buf_.ptr && data_ <= buf_.ptr+buf_.header->used );
3373 const Size tailsize = buf_.header->used -
size_ - offset;
3376 buf_.header->used -= tailsize;
3380 if (newused > buf_.header->size) {
3383 if (newbufsize <= newused)
3384 newbufsize = newused + 1;
3386 T* newbuf = buf_.memalloc(newbufsize, newused, newheader);
3388 memcpy((
void*)newbuf, (
void*)
data_,
sizeof(T)*
size_);
3393 meminit(newbuf+size_, data, size);
3398 buf_.header = newheader;
3401 }
else if (offset > 0 && size > buf_.header->size-buf_.header->used) {
3404 memmove((
void*)buf_.ptr, (
void*)
data_,
sizeof(T)*
size_);
3405 if (data >= data_ && data < data_ + size_)
3406 data -= (data_ - buf_.ptr);
3407 buf_.header->used = newused;
3411 meminit(data_+size_, data, size);
3415 if (
data_ < buf_.ptr) {
3416 assert( offset == 0 );
3419 buf_.header->used +=
size;
3431 T* newbuf = buf_.memalloc(
Capacity::init(newused+1), newused, newheader);
3434 meminit(newbuf+
size_, data, size);
3435 newheader->used = newused;
3436 data_ = buf_.replace(newbuf, newheader);
3438 #if EVO_LIST_OPT_REFTERM 3439 terminated_ =
false;
3441 }
else if (
data_ == NULL)
3449 void modPrepend(
const Item* data, Size size) {
3452 if (buf_.header != NULL) {
3453 #if EVO_LIST_OPT_LAZYBUF 3454 if (buf_.ptr == NULL) {
3455 if (buf_.header->size >= newused) {
3457 buf_.ptr = (T*)(buf_.header + 1);
3460 meminit(buf_.ptr, data, size);
3461 buf_.header->used = newused;
3464 #if EVO_LIST_OPT_REFTERM 3465 terminated_ =
false;
3472 assert( buf_.ptr != NULL );
3474 if (buf_.header->refs == 1) {
3477 if (buf_.header->used > 0) {
3478 assert(
data_ >= buf_.ptr && data_ <= buf_.ptr+buf_.header->used );
3479 offset = (ulong)(
data_ - buf_.ptr);
3481 const Size tailsize = buf_.header->used -
size_ - offset;
3484 buf_.header->used -= tailsize;
3488 if (newused > buf_.header->size) {
3491 if (newbufsize <= newused)
3492 newbufsize = newused + 1;
3494 T* newbuf = buf_.memalloc(newbufsize, newused, newheader);
3496 memcpy((
void*)(newbuf+size), (
void*)
data_,
sizeof(T)*
size_);
3501 meminit(newbuf, data, size);
3505 buf_.header = newheader;
3508 }
else if (size > offset) {
3512 memmove((
void*)(buf_.ptr+size), (
void*)
data_,
sizeof(T)*
size_);
3513 if (data >= data_ && data < data_ + size_)
3514 data += (buf_.ptr + size -
data_);
3515 buf_.header->used = newused;
3519 meminit(data_, data, size);
3526 meminit(
data_, data, size);
3535 T* newbuf = buf_.memalloc(newused, newheader);
3537 assert(
data_ != NULL );
3540 meminit(newbuf, data, size);
3541 data_ = buf_.replace(newbuf, newheader);
3542 size_ = buf_.header->used;
3543 #if EVO_LIST_OPT_REFTERM 3544 terminated_ =
false;
3546 }
else if (
data_ == NULL)
3556 Size modInsert(Size index,
const Item* data, Size size) {
3557 if (index >=
size_) {
3559 modAppend(data, size);
3560 }
else if (index == 0)
3561 modPrepend(data, size);
3563 index = modInsertMid(index, data, size);
3573 Size modInsertMid(Size index,
const Item* data, Size size) {
3574 assert( index > 0 && index <
size_ );
3575 assert(
size_ > 0 );
3577 if (buf_.header != NULL) {
3579 #if EVO_LIST_OPT_LAZYBUF 3580 if (buf_.ptr == NULL) {
3581 if (buf_.header->size >= newused) {
3583 buf_.ptr = (T*)(buf_.header + 1);
3586 const Size nextindex = index +
size;
3587 assert( nextindex < newused );
3590 meminit(buf_.ptr+index, data, size);
3591 buf_.header->used = newused;
3594 #if EVO_LIST_OPT_REFTERM 3595 terminated_ =
false;
3602 assert( buf_.ptr != NULL );
3604 if (buf_.header->refs == 1) {
3606 assert(
data_ >= buf_.ptr && data_ <= buf_.ptr+buf_.header->used );
3609 const Size tailsize = buf_.header->used -
size_ - offset;
3612 buf_.header->used -= tailsize;
3615 if (newused > buf_.header->size) {
3618 if (newbufsize <= newused)
3619 newbufsize = newused + 1;
3621 T* newbuf = buf_.memalloc(newbufsize, newused, newheader);
3622 memcpy((
void*)newbuf, (
void*)
data_,
sizeof(T)*index);
3623 memcpy((
void*)(newbuf+index+size), (
void*)(data_+index),
sizeof(T)*(
size_-index));
3628 meminit(newbuf+index, data, size);
3632 buf_.header = newheader;
3635 }
else if (size > offset) {
3639 memmove((
void*)buf_.ptr, (
void*)
data_,
sizeof(T)*index);
3640 if (data >= data_ && data < data_ + index)
3645 memmove((
void*)(ptr+size), (
void*)(ptr+offset),
sizeof(T)*(
size_-index));
3646 buf_.header->used = newused;
3649 if (data >=
data_ && data < ptr) {
3651 Size sz = (
Size)(ptr - data);
3654 meminit(ptr, data, sz);
3656 meminit(ptr+sz, ptr+size, size-sz);
3659 data += (size - offset);
3660 meminit(
data_+index, data, size);
3664 const Size newoffset = offset -
size;
3668 data_ = buf_.ptr + newoffset;
3669 memmove((
void*)
data_, (
void*)(buf_.ptr+offset),
sizeof(T)*index);
3670 data -= (offset - newoffset);
3673 if (size >= index) {
3675 T*
ptr = data_ + index;
3676 const Size sz = (
Size)(ptr - data);
3677 meminit(ptr, data, sz);
3678 meminit(ptr+sz, ptr+size, size-sz);
3680 meminit(data_+index, data, size);
3682 data_ = buf_.ptr + newoffset;
3683 memmove((
void*)
data_, (
void*)(buf_.ptr+offset),
sizeof(T)*index);
3686 meminit(data_+index, data, size);
3696 T* newbuf = buf_.memalloc(
size_+size, newheader);
3699 const Size nextindex = index +
size;
3700 assert( nextindex < newheader->used );
3703 meminit(newbuf+index, data, size);
3704 data_ = buf_.replace(newbuf, newheader);
3705 size_ = buf_.header->used;
3706 #if EVO_LIST_OPT_REFTERM 3707 terminated_ =
false;
3720 Size modRemove(Size index, Size size,
bool uninit=
true) {
3721 if (index <
size_) {
3723 const Size maxsize =
size_ - index;
3727 if (size >=
size_) {
3729 assert( size ==
size_ );
3731 if (buf_.ptr != NULL) {
3732 assert( buf_.header != NULL );
3733 if (buf_.header->refs > 1) {
3735 --buf_.header->refs;
3739 }
else if (buf_.header->used > 0) {
3741 assert( buf_.header->refs == 1 );
3746 assert(
data_ >= buf_.ptr && data_ <= buf_.ptr+buf_.header->used );
3747 const Size offset = (
Size)(
data_ - buf_.ptr);
3751 const Size tailsize = buf_.header->used -
size_ - offset;
3754 buf_.header->used -= tailsize;
3757 buf_.header->used = 0;
3762 #if !EVO_LIST_OPT_LAZYBUF 3764 assert( buf_.header == NULL );
3768 #if EVO_LIST_OPT_REFTERM 3769 terminated_ =
false;
3771 }
else if (size > 0) {
3773 if (buf_.header != NULL) {
3775 #if EVO_LIST_OPT_LAZYBUF 3776 if (buf_.ptr == NULL) {
3777 if (buf_.header->size >= newsize) {
3779 assert( buf_.header->used == 0 );
3780 buf_.ptr = (T*)(buf_.header + 1);
3783 const Size nextindex = index +
size;
3784 if (nextindex <
size_)
3786 buf_.header->used = newsize;
3789 #if EVO_LIST_OPT_REFTERM 3790 terminated_ =
false;
3797 assert( buf_.ptr != NULL );
3799 if (buf_.header->refs == 1) {
3801 assert(
data_ >= buf_.ptr && data_ <= buf_.ptr+buf_.header->used );
3802 const Size offset = (
Size)(
data_ - buf_.ptr);
3804 const Size tailsize = buf_.header->used -
size_ - offset;
3807 buf_.header->used -= tailsize;
3814 const Size nextindex = index +
size;
3815 if (nextindex <
size_)
3816 memmove((
void*)(
data_+index), (
void*)(
data_+nextindex),
sizeof(T)*(
size_-nextindex));
3817 buf_.header->used -=
size;
3824 assert(
data_ != NULL );
3827 T* newbuf = buf_.memalloc(newused+1, newused, newheader);
3831 const Size nextindex = index +
size;
3832 if (nextindex <
size_)
3835 data_ = buf_.replace(newbuf, newheader);
3836 size_ = buf_.header->used;
3837 #if EVO_LIST_OPT_REFTERM 3838 terminated_ =
false;
3843 #if !EVO_LIST_OPT_LAZYBUF 3845 assert( (buf_.header != NULL) == (buf_.ptr != NULL) );
3858 void modReplace(Size index, Size size,
const Item* data, Size newsize) {
3859 assert( size > 0 && newsize > 0 );
3860 assert( index <
size_ );
3861 assert( data != NULL );
3862 const Size maxsize =
size_ - index;
3865 if (buf_.header != NULL) {
3866 const Size newdatasize =
size_ - size + newsize;
3867 #if EVO_LIST_OPT_LAZYBUF 3868 if (buf_.ptr == NULL) {
3869 if (buf_.header->size >= newdatasize) {
3871 assert( buf_.header->used == 0 );
3872 buf_.ptr = (T*)(buf_.header + 1);
3877 const Size nextindex = index +
size;
3878 if (nextindex <
size_)
3880 buf_.header->used = newdatasize;
3882 size_ = newdatasize;
3883 #if EVO_LIST_OPT_REFTERM 3884 terminated_ =
false;
3891 assert( buf_.ptr != NULL );
3893 if (buf_.header->refs == 1) {
3895 assert(
data_ >= buf_.ptr && data_ <= buf_.ptr+buf_.header->used );
3898 const Size copysize = (size < newsize ?
size : newsize);
3899 assert( data < data_+index || data >=
data_+index+copysize );
3904 newsize -= copysize;
3908 T* dataptr =
data_ + index;
3910 const Size nextindex = index +
size;
3911 if (nextindex <
size_)
3912 memmove(dataptr,
data_+nextindex,
sizeof(T)*(
size_-nextindex));
3913 buf_.header->used -=
size;
3915 }
else if (newsize > 0) {
3922 const Size tailsize = buf_.header->used -
size_ - offset;
3925 buf_.header->used -= tailsize;
3928 if (newused > buf_.header->size) {
3931 if (newbufsize <= newused)
3932 newbufsize = newused + 1;
3934 T* newbuf = buf_.memalloc(newbufsize, newused, newheader);
3935 memcpy((
void*)newbuf, (
void*)
data_,
sizeof(T)*index);
3936 memcpy((
void*)(newbuf+index+size), (
void*)(data_+index),
sizeof(T)*(
size_-index));
3941 meminit(newbuf+index, data, size);
3945 buf_.header = newheader;
3948 }
else if (size > offset) {
3952 memmove((
void*)buf_.ptr, (
void*)
data_,
sizeof(T)*index);
3953 if (data >= data_ && data < data_ + index)
3958 memmove((
void*)(ptr+size), (
void*)(ptr+offset),
sizeof(T)*(
size_-index));
3959 buf_.header->used = newused;
3962 if (data >=
data_ && data < ptr) {
3964 Size sz = (
Size)(ptr - data);
3967 meminit(ptr, data, sz);
3969 meminit(ptr+sz, ptr+size, size-sz);
3972 data += (size - offset);
3973 meminit(
data_+index, data, size);
3977 const Size newoffset = (
Size)(offset - size);
3981 data_ = buf_.ptr + newoffset;
3982 memmove((
void*)
data_, (
void*)(buf_.ptr+offset),
sizeof(T)*index);
3983 data -= (offset - newoffset);
3986 if (size >= index) {
3988 T*
ptr = data_ + index;
3989 const Size sz = (
Size)(ptr - data);
3990 meminit(ptr, data, sz);
3991 meminit(ptr+sz, ptr+size, size-sz);
3993 meminit(data_+index, data, size);
3995 data_ = buf_.ptr + newoffset;
3996 memmove((
void*)
data_, (
void*)(buf_.ptr+offset),
sizeof(T)*index);
3999 meminit(data_+index, data, size);
4010 T* newbuf = buf_.memalloc(
size_-size+newsize, newheader);
4015 const Size fromindex = index +
size;
4016 if (fromindex <
size_)
4019 data_ = buf_.replace(newbuf, newheader);
4020 size_ = buf_.header->used;
4021 #if EVO_LIST_OPT_REFTERM 4022 terminated_ =
false;
4031 static void meminit(T*
ptr,
const Item* data, Size size) {
4034 else if (data != NULL)
4042 #if defined(_MSC_VER) 4043 #pragma warning(pop) ListType & unslice()
Clean and remove hidden items previously removed via slicing (modifier).
Definition: list.h:1427
ListType & add(const Item *data, Size size)
Append new items copied from data pointer (modifier).
Definition: list.h:2019
Iter cend() const
Get iterator at end (const).
Definition: list.h:961
static void copy(Item *dest, const Item *src, ulong size)
Copy already initialized data (assignment operator).
Definition: container.h:297
List(const ListType &data, Key index, Key size=ALL)
Extended copy constructor.
Definition: list.h:381
bool pop(T &item)
Pop a copy of last item (stack) (modifier).
Definition: list.h:2219
Size size() const
Get size.
Definition: list.h:759
static void init_tail_safe(Item *data, ulong oldSize, ulong newSize)
Initialize new tail data (default constructor).
Definition: container.h:252
T & max(T &a, T &b)
Returns highest of given values.
Definition: alg.h:47
void swap(Key index1, Key index2)
Swap items.
Definition: list.h:2497
T * advWrite(Size addsize)
Advanced: Get buffer pointer to write/append (modifier).
Definition: list.h:2768
void advPrepend(Size size)
Advanced: Prepend new items without initializing (constructing) them.
Definition: list.h:2834
T * dataM()
Get data pointer (mutable).
Definition: list.h:1464
static ulong grow(ulong size)
Grow data size.
Definition: container.h:113
Key findr(ItemVal item, Key start=0, Key end=END) const
Find last occurrence of item with reverse search.
Definition: list.h:1032
ListType & add(const ListBaseType &data)
Append new items copied from another list (modifier).
Definition: list.h:2029
Size capacity() const
Get capacity.
Definition: list.h:777
const Item * pop()
Pop last item (stack).
Definition: list.h:2237
ListType & operator=(const ListType &data)
Assignment operator.
Definition: list.h:522
void clear()
Clear data and free buffer.
Definition: list.h:287
void swap(ListType &list)
Swap with another list.
Definition: list.h:2509
List buffer data helper.
Definition: list.h:3008
T & advItem(Key index)
Advanced: Get item (mutable).
Definition: list.h:2796
ValEmpty
Special empty value type, pass as vEMPTY.
Definition: sys.h:1101
ListType & operator=(ListType &&src)
Move assignment operator (C++11).
Definition: list.h:496
bool splitat(Key index, T1 &left, T2 &right) const
Split into left/right sublists at index.
Definition: list.h:1151
Iter begin() const
Get iterator at first item (const).
Definition: list.h:980
bool starts(const ListBaseType &items) const
Check if this starts with given items.
Definition: list.h:912
Key findany(const Item *items, Size count, Key start=0, Key end=END) const
Find first occurrence of any given items with forward search.
Definition: list.h:1051
Size insertnew(Key index, Size size=1)
Insert new items (modifier).
Definition: list.h:2154
void advSize(Size size)
Advanced: Set new size after writing directly to buffer.
Definition: list.h:2754
T Item
Item type (same as Value)
Definition: list.h:250
ListType & set2(const ListType &data, Key index1, Key index2)
Set from subset of another list using start/end positions.
Definition: list.h:700
List(const Item *data, Size size)
Constructor for data pointer.
Definition: list.h:448
ListType & operator<<(const ListBaseType &data)
Append operator.
Definition: list.h:2069
Key iend(Size offset=0) const
Get index from last item using offset.
Definition: list.h:826
void ref(const ListType &data)
Set as reference to another list.
Definition: list.h:3144
int compare(const ListBaseType &data) const
Comparison.
Definition: list.h:842
void * header
Internal buffer data, do not modify.
Definition: list.h:274
ListType & reserve(Size size, bool prefer_realloc=false)
Reserve capacity for additional items (modifier).
Definition: list.h:1703
ListType & slice2(Key index1, Key index2)
Slice to given sublist using start/end positions.
Definition: list.h:1418
List(std::initializer_list< T > init)
Sequence constructor (C++11).
Definition: list.h:476
Random access iterator.
Definition: iter.h:904
ValNull
Unique null value type and value (vNULL).
Definition: sys.h:1096
ListType & fill(const Item &item, Key index=0, Size size=ALL)
Fill using item (modifier).
Definition: list.h:2291
ListType & prepend(const Item &data)
Prepend new item (modifier).
Definition: list.h:2144
void move(Key dest, Key index)
Move item to position (modifier).
Definition: list.h:2338
ListType & prepend(const Item *data, Size size)
Prepend new items copied from data pointer (modifier).
Definition: list.h:2125
void free()
Free and uninitialize allocated buffer.
Definition: list.h:3112
Size size
Data size, update after write.
Definition: list.h:273
bool contains(const ListBaseType &data) const
Check if contains given data.
Definition: list.h:1124
ListType & operator=(const ListBaseType &data)
Assignment operator to copy sublist.
Definition: list.h:531
Edit()
Constructor.
Definition: list.h:277
ListType & copy(const ListBaseType &data)
Set as full (unshared) copy of another list (modifier).
Definition: list.h:1979
ListType & compact()
Reduce capacity to fit current size (modifier).
Definition: list.h:1686
const ListType & asconst() const
Explicitly use a const reference to this.
Definition: list.h:510
static void init_tail_fast(Item *data, ulong oldSize, ulong newSize)
Initialize new tail data (default constructor).
Definition: container.h:270
void advWriteDone(Size addsize)
Advanced: Update size added after writing directly to buffer.
Definition: list.h:2784
T * ptr
Data pointer, use to write to buffer.
Definition: list.h:272
Size insert(Key index, const ListBaseType &data)
Insert new items copied from another list (modifier).
Definition: list.h:2171
ListType & capacitymin(Size min)
Set minimum capacity (modifier).
Definition: list.h:1650
Basic integer type.
Definition: type.h:980
T & operator()(Key index)
Get item at position (mutable).
Definition: list.h:1475
const Item & item(Key index) const
Get item at position (const).
Definition: list.h:804
ListType & reverse()
Reverse item order (modifier).
Definition: list.h:2519
void advEditDone(Edit &edit)
Advanced: Finish edit started with advEdit() (modifier).
Definition: list.h:2697
void ref(const ListType &data, Size index, Size size)
Set as sliced reference to another list.
Definition: list.h:3203
bool splitat(Key index, T1 &left) const
Split into left sublist at index.
Definition: list.h:1177
void memfree()
Free buffer memory.
Definition: list.h:3099
ulong hash(ulong seed=0) const
Get data hash value.
Definition: list.h:833
bool ends(ItemVal item) const
Check if this ends with given item.
Definition: list.h:921
Key advInsert(Key index, Size size)
Advanced: Insert new items without initializing (constructing) them.
Definition: list.h:2846
bool contains(ItemVal item) const
Check whether contains given item.
Definition: list.h:1092
TSize Size
List size integer type
Definition: list.h:247
ListType & prepend(const ListBaseType &data)
Prepend new items copied from another list (modifier).
Definition: list.h:2135
const Item * data() const
Get data pointer (const).
Definition: list.h:786
ListType & set2(const ListBaseType &data, Key index1, Key index2)
Set as copy of sublist using start/end positions.
Definition: list.h:711
ListType & add(const Item &data)
Append new item (modifier).
Definition: list.h:2039
~Edit()
Destructor, frees buffer if needed.
Definition: list.h:281
void advAdd(Size size)
Advanced: Append new items without initializing (constructing) them.
Definition: list.h:2824
#define EVO_PEMPTY
Special pointer value for empty but not NULL (used in containers).
Definition: type.h:1858
List(const ValEmpty &val)
Constructor sets as empty but not null.
Definition: list.h:351
Size write(const ListBaseType &src, Size start=0, Size count=ALL)
Write (copy) data from source.
Definition: list.h:307
Iter end() const
Get iterator at end (const).
Definition: list.h:1000
Size move(Key dest, ListType &src, Key srcindex=0, Size size=ALL)
Move items from another list.
Definition: list.h:2365
List< T, Size > ListType
List type for parameters
Definition: list.h:254
Data equality helper.
Definition: container.h:712
bool starts(const Item *items, Size size) const
Check if starts with given items.
Definition: list.h:903
bool empty() const
Get whether empty.
Definition: list.h:753
List(ListType &&src)
Move constructor (C++11).
Definition: list.h:487
Evo implementation detail: Container iterators.
bool ends(const ListBaseType &items) const
Check if this ends with given items.
Definition: list.h:940
bool null() const
Get whether null.
Definition: list.h:745
bool popq(T &item)
Pop a copy of first item (queue) (modifier).
Definition: list.h:2253
ListType & addmin(Size minsize)
Append new items up to a given minimum size (modifier).
Definition: list.h:2005
ListType & triml(Size size)
Trim left (beginning) items.
Definition: list.h:1307
ListType & operator<<(const ValNull &val)
Append operator to set as null and empty.
Definition: list.h:2084
static const EndT END
Special integer value for indicating end of items or no item.
Definition: type.h:1846
void ref(const Item *data, Size size, bool term=false)
Set as reference to given data.
Definition: list.h:3268
ListType & capacity(Size size)
Set new capacity (modifier).
Definition: list.h:1516
ListType & addnew(Size size=1)
Append new items (modifier).
Definition: list.h:1996
const Item * first() const
Get first item (const).
Definition: list.h:810
const Item & operator[](Key index) const
Get item at position (const).
Definition: list.h:795
static const EndT ALL
Special integer value for indicating all items or all remaining items.
Definition: type.h:1839
ListType & trimr(Size size)
Trim right (ending) items.
Definition: list.h:1323
Evo container foundation types and macros.
ListType & clear()
Clear by removing all items.
Definition: list.h:574
Edit buffer for advEdit().
Definition: list.h:271
Iter cbegin() const
Get iterator at first item (const).
Definition: list.h:951
bool shared() const
Get whether shared.
Definition: list.h:767
ListType & operator=(const ValNull &)
Assignment operator to set as null and empty.
Definition: list.h:550
List(const ListBaseType &data, Key index=0, Key size=ALL)
Constructor to copy sublist data.
Definition: list.h:397
ListType & slice(Key index, Size size)
Slice to given sublist.
Definition: list.h:1382
static ulong hash(const T *data, ulong size, ulong seed=0)
Compute hash value from data.
Definition: container.h:899
T * advLast()
Advanced: Get last item (modifier).
Definition: list.h:2814
bool splitat_setl(Key index, T2 &right)
Split at index, set as left sublist, and save right sublist.
Definition: list.h:1244
Item * lastM()
Get last item (mutable).
Definition: list.h:1503
IterM end()
Get iterator at end.
Definition: list.h:990
ListType & setempty()
Set as empty but not null.
Definition: list.h:735
void advSwap(Key index1, Key index2)
Advanced: Swap given items.
Definition: list.h:2867
bool starts(ItemVal item) const
Check if this starts with given item.
Definition: list.h:893
Evo C++ Library namespace.
Definition: alg.h:11
ListType & prependnew(Size size=1)
Prepend new items (modifier).
Definition: list.h:2114
static const EndT NONE
Special integer value for indicating no item or unknown item.
Definition: type.h:1832
List(const PtrBase< Item > &data, Size size)
Constructor to copy from managed pointer.
Definition: list.h:462
static bool equal(const T *data1, const T *data2, ulong size)
Compare array data for equality.
Definition: container.h:721
T * advFirst()
Advanced: Get first item (modifier).
Definition: list.h:2806
T * memalloc(Size size, Header *&header)
Allocate new memory.
Definition: list.h:3068
T * memalloc(Size size, Size used, Header *&header)
Allocate new memory.
Definition: list.h:3041
bool advEdit(Edit &edit, Size minsize, bool inplace=true)
Advanced: Start optimized in-place/buffer edit.
Definition: list.h:2648
ListType & operator<<(const ValEmpty &val)
Append operator to set as empty but not null.
Definition: list.h:2100
bool ends(const Item *items, Size size) const
Check if this ends with given items.
Definition: list.h:931
bool operator==(const ListBaseType &data) const
Equality operator.
Definition: list.h:857
Size write(const Item *data, Size count)
Write (copy) data from buffer.
Definition: list.h:329
T * advBuffer()
Advanced: Get buffer pointer (modifier).
Definition: list.h:2743
static void uninit(Item *data, ulong size)
Uninitialize data (destructor).
Definition: container.h:311
Size Key
Key type (item index)
Definition: list.h:248
static int compare(const T *data1, ulong size1, const T *data2, ulong size2)
Compare data.
Definition: container.h:769
ListType & capacitymax(Size max)
Set maximum capacity (modifier).
Definition: list.h:1668
ListType & operator<<(const Item &data)
Append operator.
Definition: list.h:2054
List(const ListType &data)
Copy constructor.
Definition: list.h:365
Buf buf_
List buffer.
Definition: list.h:3136
ListType & resize(Size size)
Resize while preserving existing data (modifier).
Definition: list.h:1850
T * memrealloc(Size size)
Reallocate buffer memory.
Definition: list.h:3077
DataCopy< T >::PassType ItemVal
Item type as parameter (POD types passed by value, otherwise by const-ref)
Definition: list.h:251
T * data_
Data pointer, NULL if null.
Definition: sys.h:979
P ptr_
Pointer.
Definition: type.h:1566
List< T, Size > ThisType
This list type.
Definition: list.h:253
AddConst< T >::Type & PassType
Most efficient type for passing as parameter (const-reference or POD value).
Definition: container.h:551
IteratorRa< ThisType >::Const Iter
Iterator (const) - IteratorRa.
Definition: list.h:263
IteratorRa< ThisType > IterM
Iterator (mutable) - IteratorRa.
Definition: list.h:264
static void init(Item *data, ulong size=1)
Initialize data using default constructor.
Definition: container.h:198
List()
Default constructor sets as null.
Definition: list.h:340
ListType & operator=(const ValEmpty &)
Assignment operator to set as empty but not null.
Definition: list.h:560
ListBase< T, Size > ListBaseType
List base type for any Evo list
Definition: list.h:255
Key find(ItemVal item, Key start=0, Key end=END) const
Find first occurrence of item with forward search.
Definition: list.h:1013
T * advBuffer(Size size)
Advanced: Resize and get buffer pointer (modifier).
Definition: list.h:2728
bool splitat(Key index, ValNull left, T2 &right) const
Split into right sublist at index.
Definition: list.h:1202
T Value
Value type (same as Item)
Definition: list.h:249
Size insert(Key index, const Item *data, Size size)
Insert new items copied from data pointer (modifier).
Definition: list.h:2163
static void fill(T *dest, ulong size, const T &value)
Fill with copies of given item.
Definition: container.h:621
TSize size_
Data size as item count, 0 if empty or null.
Definition: sys.h:980
bool contains(const Item *data, Size size) const
Check if contains given data.
Definition: list.h:1107
Sequential list container with random access.
Definition: list.h:240
Buf()
Constructor.
Definition: list.h:3016
static void init_safe(Item *data, ulong size=1)
Initialize data using default constructor.
Definition: container.h:159
bool pop(T &item, Key index)
Pop a copy of given item (modifier).
Definition: list.h:2201
ListType & unshare()
Make data unique by allocating new buffer, if needed (modifier).
Definition: list.h:1783
ListType & truncate(Size size=0)
Truncate to given size.
Definition: list.h:1342
const Item * popq()
Pop first item (queue).
Definition: list.h:2270
bool splitat_setl(Key index)
Split at index and set as left sublist.
Definition: list.h:1224
~Buf()
Destructor.
Definition: list.h:3022
static ulong init(ulong size)
Get initial data size.
Definition: container.h:103
T & itemM(Key index)
Get item at position (mutable).
Definition: list.h:1487
bool operator!=(const ListBaseType &data) const
Inequality operator.
Definition: list.h:874
T * replace(T *newptr, Header *newheader)
Free and uninitialize current buffer and replace with new buffer.
Definition: list.h:3125
Base managed pointer.
Definition: type.h:1562
ListType & advResize(Size size)
Advanced: Resize while preserving existing data, POD items not initialized (modifier).
Definition: list.h:2552
Base for all Evo list types (used internally).
Definition: sys.h:976
ListType & replace(Key index, Size rsize, const Item *data, Size size)
Replace items with new data (modifier).
Definition: list.h:2316
T & min(T &a, T &b)
Returns lowest of given values.
Definition: alg.h:26
bool splitat_setr(Key index)
Split at index and set as right sublist.
Definition: list.h:1264
#define EVO_PDEFAULT
Special pointer value for default initialization (used in containers).
Definition: type.h:1853
ListType & copy(const Item *data, Size size)
Set as full (unshared) copy using data pointer (modifier).
Definition: list.h:1929
const Item * last() const
Get last item (const).
Definition: list.h:816
ListType & slice(Key index)
Slice beginning items.
Definition: list.h:1360
void advRemove(Key index, Size size)
Advanced: Remove given items without uninitializing (destructing) them.
Definition: list.h:2857
Key findanyr(const Item *items, Size count, Key start=0, Key end=END) const
Find last occurrence of any given items with reverse search.
Definition: list.h:1073
List(const ListBaseType *data, Key index=0, Key size=ALL)
Constructor to copy sublist data.
Definition: list.h:423
Item * firstM()
Get first item (mutable).
Definition: list.h:1495
T * ptr
Data pointer, NULL if buffer not used.
Definition: list.h:3010
bool splitat_setr(Key index, T1 &left)
Split at index, set as right sublist, and save left sublist.
Definition: list.h:1285
void clear()
Clear buffer data.
Definition: list.h:3028
#define EVO_PARAM_UNUSED(NAME)
Mark function parameter as unused to suppress "unreferenced parameter" compiler warnings on it...
Definition: sys.h:427
Size insert(Key index, const Item &data)
Insert new item (modifier).
Definition: list.h:2179
IterM begin()
Get iterator at first item (mutable).
Definition: list.h:971
Header * header
Data header pointer, NULL if no buffer allocated.
Definition: list.h:3009