diff options
Diffstat (limited to 'src/lib/netlist/plib/plists.h')
-rw-r--r-- | src/lib/netlist/plib/plists.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h index 9cdca8813a0..46a679cc81b 100644 --- a/src/lib/netlist/plib/plists.h +++ b/src/lib/netlist/plib/plists.h @@ -12,6 +12,8 @@ #include "pstring.h" +#include <array> +#include <type_traits> #include <vector> namespace plib { @@ -34,6 +36,7 @@ public: uninitialised_array_t() = default; + COPYASSIGNMOVE(uninitialised_array_t, delete) ~uninitialised_array_t() { for (std::size_t i=0; i<N; i++) @@ -74,7 +77,7 @@ private: /* ensure proper alignment */ // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays) - typename std::aligned_storage<sizeof(C), alignof(C)>::type m_buf[N]; + std::array<typename std::aligned_storage<sizeof(C), alignof(C)>::type, N> m_buf; }; // ---------------------------------------------------------------------------------------- @@ -180,14 +183,12 @@ public: friend class linkedlist_t<LC>; constexpr element_t() : m_next(nullptr), m_prev(nullptr) {} - constexpr element_t(const element_t &rhs) = delete; - constexpr element_t(element_t &&rhs) = delete; + ~element_t() noexcept = default; + + COPYASSIGNMOVE(element_t, delete) constexpr LC *next() const noexcept { return m_next; } constexpr LC *prev() const noexcept { return m_prev; } - - protected: - ~element_t() = default; private: LC * m_next; LC * m_prev; @@ -205,6 +206,9 @@ public: iter_t& operator=(iter_t &&rhs) noexcept { std::swap(*this, rhs); return *this; } iter_t& operator++() noexcept {p = p->next();return *this;} iter_t operator++(int) noexcept {iter_t tmp(*this); operator++(); return tmp;} + + ~iter_t() = default; + constexpr bool operator==(const iter_t& rhs) const noexcept {return p == rhs.p;} constexpr bool operator!=(const iter_t& rhs) const noexcept {return p != rhs.p;} /* constexpr */ LC& operator*() noexcept {return *p;} |