diff --git a/include/const_list.h b/include/const_list.h index 1306694..330262e 100644 --- a/include/const_list.h +++ b/include/const_list.h @@ -13,6 +13,7 @@ namespace cc { + template class const_list_node; template @@ -68,7 +69,7 @@ namespace cc { constexpr _const_const_list_iterator operator--(int) & noexcept override { auto tmp = *this; _Base::_curr == _Base::_curr->_prev; return tmp; } }; - template + template requires std::derived_from class const_list { @@ -86,14 +87,10 @@ namespace cc { using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; - private: const_list_node *_start; const_list_node *_end; std::size_t _size; - CompileOptional> _alloc; - - using alloc_defined = decltype(_alloc)::defined; public: @@ -208,10 +205,13 @@ namespace cc { }; + template class const_list_node { + static_assert(std::derived_from) private: const_list_node *_prev; const_list_node *_next; + const_list *_owner; friend class const_list; friend class _const_list_iterator_base; @@ -221,390 +221,39 @@ namespace cc { template const_list(InputIt, InputIt) -> const_list::value_type>; - template - constexpr bool operator==(const const_list& lhs, - const const_list& rhs) + template + constexpr bool operator==(const const_list& lhs, + const const_list& rhs) { return lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } - template - constexpr auto operator<=>(const const_list& lhs, - const const_list& rhs) + template + constexpr auto operator<=>(const const_list& lhs, + const const_list& rhs) { return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } - template - constexpr void swap(const const_list& lhs, - const const_list& rhs) + template + constexpr void swap(const const_list& lhs, + const const_list& rhs) { lhs.swap(rhs); } - template - constexpr const_list::size_type erase(const_list& c, const N& value) + template + constexpr const_list::size_type erase(const_list& c, const N& value) { c.remove(value); } - template - constexpr const_list::size_type erase(const_list& c, Pred pred) + template + constexpr const_list::size_type erase(const_list& c, Pred pred) { c.remove_if(pred); } - template - requires std::derived_fromconstexpr - const_list::const_list(const_list::size_type count) noexcept - { - - } - - template - requires std::derived_fromconstexpr - const_list::const_list(const_list::size_type count, const value_type &value) noexcept - { - - } - - template - requires std::derived_from - template - constexpr const_list::const_list(InputIt first, InputIt last) - { - - } - - template - requires std::derived_fromconstexpr - const_list::const_list(const const_list &other) noexcept - { - - } - - template - requires std::derived_fromconstexpr - const_list::const_list(const_list &&other) noexcept - { - - } - - template - requires std::derived_fromconstexpr - const_list::const_list(std::initializer_list init) noexcept - { - - } - - template - requires std::derived_fromconstexpr const_list::~const_list() - { - - } - - template - requires std::derived_fromconstexpr const_list & - const_list::operator=(const const_list &other) - { - return <#initializer#>; - } - - template - requires std::derived_fromconstexpr const_list & - const_list::operator=(const_list &&other) - { - return <#initializer#>; - } - - template - requires std::derived_fromconstexpr const_list & - const_list::operator=(std::initializer_list init) - { - return <#initializer#>; - } - - template - requires std::derived_fromconstexpr void - const_list::assign(const_list::size_type count, const value_type &value) noexcept - { - - } - - template - requires std::derived_from - template - constexpr void const_list::assign(InputIt first, InputIt last) - { - - } - - template - requires std::derived_fromconstexpr void - const_list::assign(std::initializer_list values) - { - - } - - template - requires std::derived_fromvoid const_list::clear() noexcept - { - - } - - template - requires std::derived_fromconstexpr const_list::iterator - const_list::insert(const_list::const_iterator pos, const value_type &value) - { - return cc::const_list::iterator(); - } - - template - requires std::derived_fromconstexpr const_list::iterator - const_list::insert(const_list::const_iterator pos, value_type &&value) - { - return cc::const_list::iterator(); - } - - template - requires std::derived_fromconstexpr const_list::iterator - const_list::insert(const_list::const_iterator pos, const_list::size_type count, const value_type &value) - { - return cc::const_list::iterator(); - } - - template - requires std::derived_from - template - constexpr const_list::iterator - const_list::insert(const_list::const_iterator pos, InputIt first, InputIt last) - { - return cc::const_list::iterator(); - } - - template - requires std::derived_fromconstexpr const_list::iterator - const_list::insert(const_list::const_iterator pos, std::initializer_list values) - { - return cc::const_list::iterator(); - } - - template - requires std::derived_from - template - constexpr const_list::iterator const_list::emplace(const_list::const_iterator pos, Args &&... args) - { - return cc::const_list::iterator(); - } - - template - requires std::derived_fromconstexpr const_list::iterator - const_list::erase(const_list::const_iterator pos) - { - return cc::const_list::iterator(); - } - - template - requires std::derived_fromconstexpr const_list::iterator - const_list::erase(const_list::const_iterator first, const_list::const_iterator last) - { - return cc::const_list::iterator(); - } - - template - requires std::derived_fromconstexpr void - const_list::push_back(const value_type &value) - { - - } - - template - requires std::derived_fromconstexpr void const_list::push_back(value_type &&value) - { - - } - - template - requires std::derived_from - template - constexpr reference const_list::emplace_back(Args &&... args) - { - return <#initializer#>; - } - - template - requires std::derived_fromconstexpr void const_list::pop_back() - { - - } - - template - requires std::derived_fromconstexpr void - const_list::push_front(const value_type &value) - { - - } - - template - requires std::derived_fromconstexpr void const_list::push_front(value_type &&value) - { - - } - - template - requires std::derived_from - template - constexpr reference const_list::emplace_front(Args &&... args) - { - return <#initializer#>; - } - - template - requires std::derived_fromconstexpr void const_list::pop_front() - { - - } - - template - requires std::derived_fromconstexpr void - const_list::resize(const_list::size_type count) - { - - } - - template - requires std::derived_fromconstexpr void - const_list::resize(const_list::size_type count, const value_type &value) - { - - } - - template - requires std::derived_fromconstexpr void const_list::swap(const_list &other) noexcept - { - - } - - template - requires std::derived_fromconstexpr void const_list::merge(const_list &other) - { - - } - - template - requires std::derived_fromconstexpr void const_list::merge(const_list &&other) - { - - } - - template - requires std::derived_from - template - constexpr void const_list::merge(const_list &other, Compare comp) - { - - } - - template - requires std::derived_from - template - constexpr void const_list::merge(const_list &&other, Compare comp) - { - - } - - template - requires std::derived_fromconstexpr void - const_list::splice(const_list::const_iterator pos, const_list &other) - { - - } - - template - requires std::derived_fromconstexpr void - const_list::splice(const_list::const_iterator pos, const_list &&other) - { - - } - - template - requires std::derived_fromconstexpr void - const_list::splice(const_list::const_iterator pos, const_list &other, const_list::const_iterator it) - { - - } - - template - requires std::derived_fromconstexpr void - const_list::splice(const_list::const_iterator pos, const_list &&other, const_list::const_iterator it) - { - - } - - template - requires std::derived_fromconstexpr void - const_list::splice(const_list::const_iterator pos, const_list &other, const_list::const_iterator first, - const_list::const_iterator last) - { - - } - - template - requires std::derived_fromconstexpr void - const_list::splice(const_list::const_iterator pos, const_list &&other, const_list::const_iterator first, - const_list::const_iterator last) - { - - } - - template - requires std::derived_fromconstexpr const_list::size_type - const_list::remove(const value_type &value) - { - return 0; - } - - template - requires std::derived_from - template - const_list::size_type const_list::remove_if(UnaryPredicate p) - { - return 0; - } - - template - requires std::derived_fromvoid const_list::reverse() noexcept - { - - } - - template - requires std::derived_fromconst_list::size_type const_list::unique() - { - return 0; - } - - template - requires std::derived_from - template - constexpr const_list::size_type const_list::unique(BinaryPredicate p) - { - return 0; - } - - template - requires std::derived_fromconstexpr void const_list::sort() - { - - } - - template - requires std::derived_from - template - void const_list::sort(Compare comp) - { - - } } // cc