3 ms·
> In multi-threaded context insertion and deletion can be done lock-free which is not the case for arrays I just love when multithreaded code frees the elemen
by josefx 10y ago
> In multi-threaded context insertion and deletion can be done lock-free which is not the case for arrays
I just love when multithreaded code frees the element I currently iterate over in a different thread.
> For intrusive list, insertion and deletion can't fail due to memory allocation ;
As long as you store your elements on the stack or use static values you mean? Heap allocation happens at some point, you just move the location where it happens.
> If you do only insertion at the tail and removal at the head these operation need only a pointer change which is more efficient than an array
Use a circular buffer. Until the array is full you can just modify the start/end pointers.