ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.04k stars 371 forks source link

Allow removal of a node from an etl::intrusive_list #874

Closed jwellbelove closed 2 months ago

jwellbelove commented 3 months ago

Discussed in https://github.com/ETLCPP/etl/discussions/872

Originally posted by **pwsoftwaredesigns** March 27, 2024 I have been manually writing intrusive list code in my applications. I wanted to write a template classes to perform all the logic of an intrusive list instead of doing it manually over and over. But I discovered that ETL already has an intrusive_list type that seems to do what I want. I understand how an item is added to the list. However, I can't figure out how to remove an item from the list. Using the remove method isn't quite right because it requires the underlying type has operator== (which doesn't check that the items being remove is the same item, only that it is logically equivalent). If I were writing an intrusive list myself, the "remove" method would take a pointer (or reference) to the node, it would then search the list to make sure the node is actually a part of the list, then remove the item from the list by changing the intrusive links. Is there a way to do this with etl::intrusive_list?
jwellbelove commented 2 months ago

Added 20.38.11