Intrusive forward list add remove by pointer (#1026)

* Add intrusive_forward_list::remove() element by pointer

* Add test
This commit is contained in:
rolandreichweinbmw 2025-03-01 19:24:30 +01:00 committed by John Wellbelove
parent 9c22c6ce50
commit a733502359

View File

@ -1011,6 +1011,29 @@ namespace etl
}
}
//*************************************************************************
// Removes the element specified by pointer.
//*************************************************************************
void remove(const_pointer element)
{
iterator i_item = begin();
iterator i_last_item = before_begin();
while (i_item != end())
{
if (&i_item == element)
{
i_item = erase_after(i_last_item);
return;
}
else
{
++i_item;
++i_last_item;
}
}
}
//*************************************************************************
/// Removes according to a predicate.
//*************************************************************************