From 8062afc25e895cb49e76f6e26e51a7d4a1ad2df2 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Sat, 1 Feb 2025 23:32:55 +0100 Subject: revamp input system --- lib/nes/common/list.hh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/nes/common/list.hh') diff --git a/lib/nes/common/list.hh b/lib/nes/common/list.hh index d7a7d9b..b1fddf0 100644 --- a/lib/nes/common/list.hh +++ b/lib/nes/common/list.hh @@ -106,10 +106,10 @@ namespace nes } /// Remove an item from the list. - auto remove(T& item) -> void + auto remove(T& item) -> bool { node& item_node = item; - if (!item_node.list_) { return; } + if (!item_node.list_) { return false; } if (head_ == &item) { head_ = item_node.next_; } if (tail_ == &item) { tail_ = item_node.prev_; } @@ -119,12 +119,15 @@ namespace nes item_node.next_ = nullptr; item_node.prev_ = nullptr; item_node.list_ = nullptr; + + return true; } /// Remove an item from the list by its iterator. - auto remove(iterator it) -> void + auto remove(iterator it) -> bool { - if (it != end()) { remove(**it); } + if (it != end()) { return remove(**it); } + return false; } }; } // namespace nes \ No newline at end of file -- cgit v1.3.1