logoalt Hacker News

arbitrandomusertoday at 7:46 AM2 repliesview on HN

what is an intrusive data structure?


Replies

ahartmetztoday at 9:03 AM

A container class that needs cooperation from the contained items, usually with special data fields. For example, a doubly linked list where the forward and back pointers are regular member variables of the contained items. Intrusive containers can avoid memory allocations (which can be a correctness issue in a kernel) and go well with C's lack of built-in container classes. They are somewhat common in C and very rare in C++ and Rust.

show 1 reply
ajuctoday at 8:40 AM

A data structure that requires you to change the data to use it.

Like a linked list that forces you to add a next pointer to the record you want to store in it.