From 5cda16f84602621b0afa7f40a6772726d7dbce56 Mon Sep 17 00:00:00 2001 From: cyborg1811m Date: Tue, 6 Feb 2024 22:22:07 +0100 Subject: [PATCH] const_list: added linking of other linked nodes in const_list_node::push_before --- include/const_list.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/const_list.h b/include/const_list.h index 219ac72..5b8b8c5 100644 --- a/include/const_list.h +++ b/include/const_list.h @@ -454,8 +454,6 @@ namespace cc { first2 = next; } - other._tail._next = &other._tail; - other._tail._prev = &other._tail; other._size = 0; } @@ -490,8 +488,6 @@ namespace cc { first2 = next; } - other._tail._next = &other._tail; - other._tail._prev = &other._tail; other._size = 0; } @@ -569,6 +565,9 @@ namespace cc { template constexpr void const_list_node::push_before(const_list_node *node) noexcept { + node->_prev->_next = node->_next; + node->_next->_prev = node->_prev; + node->_prev = _prev; node->_next = this;