util/IntrusiveForwardList: add non-static insert_after() implementation
This commit is contained in:
parent
df7ed27b78
commit
5c44082b77
|
@ -317,9 +317,10 @@ public:
|
|||
++counter;
|
||||
}
|
||||
|
||||
static iterator insert_after(iterator pos, reference t) noexcept {
|
||||
// no counter update in this static method
|
||||
static_assert(!constant_time_size);
|
||||
static iterator insert_after(iterator pos, reference t) noexcept
|
||||
requires(!constant_time_size) {
|
||||
/* if we have no counter, then this method is allowed
|
||||
to be static */
|
||||
|
||||
auto &pos_node = *pos.cursor;
|
||||
auto &new_node = ToNode(t);
|
||||
|
@ -328,6 +329,15 @@ public:
|
|||
return &new_node;
|
||||
}
|
||||
|
||||
iterator insert_after(iterator pos, reference t) noexcept {
|
||||
auto &pos_node = *pos.cursor;
|
||||
auto &new_node = ToNode(t);
|
||||
new_node.next = pos_node.next;
|
||||
pos_node.next = &new_node;
|
||||
++counter;
|
||||
return &new_node;
|
||||
}
|
||||
|
||||
void erase_after(iterator pos) noexcept {
|
||||
pos.cursor->next = pos.cursor->next->next;
|
||||
--counter;
|
||||
|
|
Loading…
Reference in New Issue