diff options
Diffstat (limited to 'src/lib/netlist/plib/plists.h')
-rw-r--r-- | src/lib/netlist/plib/plists.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h index 5f2c7b6706d..a5340193b3c 100644 --- a/src/lib/netlist/plib/plists.h +++ b/src/lib/netlist/plib/plists.h @@ -133,10 +133,12 @@ namespace plib { constexpr iter_t(iter_t &rhs) noexcept : p(rhs.p) { } iter_t(iter_t &&rhs) noexcept { std::swap(*this, rhs); } - iter_t& operator=(const iter_t &rhs) noexcept + iter_t& operator=(const iter_t &rhs) noexcept // NOLINT(bugprone-unhandled-self-assignment, cert-oop54-cpp) { - if (this != &rhs) - p = rhs.p; + if (this == &rhs) + return *this; + + p = rhs.p; return *this; } @@ -156,7 +158,7 @@ namespace plib { C14CONSTEXPR LC* operator->() const noexcept { return p; } }; - constexpr linkedlist_t() : m_head(nullptr) {} + constexpr linkedlist_t() noexcept : m_head(nullptr) {} constexpr iter_t begin() const noexcept { return iter_t(m_head); } constexpr iter_t end() const noexcept { return iter_t(nullptr); } @@ -326,7 +328,7 @@ namespace plib { m_prof_call.inc(); } - T pop() noexcept { return *(--m_end); } + void pop() noexcept { --m_end; } const T &top() const noexcept { return *(m_end-1); } template <bool KEEPSTAT, class R> @@ -461,8 +463,7 @@ namespace plib { if (*i == elem) { m_end--; - for (;i < m_end; i++) - *i = std::move(*(i+1)); + *i = *m_end; std::make_heap(&m_list[0], m_end, compare()); return; } |