mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Intrusive forward list add remove by pointer (#1026)
* Add intrusive_forward_list::remove() element by pointer * Add test
This commit is contained in:
parent
9c22c6ce50
commit
a733502359
@ -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.
|
||||
//*************************************************************************
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user