reverted allocator

This commit is contained in:
Patrick 2024-01-27 15:54:07 +01:00
parent 721ac997ee
commit 57ece61c43
1 changed files with 35 additions and 379 deletions

View File

@ -13,10 +13,11 @@
namespace cc {
template<typename D>
class const_list_node;
template<typename N>
requires std::derived_from<N, const_list_node>
requires std::derived_from<N, const_list_node<N>>
class _const_list_iterator_base {
protected:
N *_curr;
@ -68,32 +69,28 @@ namespace cc {
constexpr _const_const_list_iterator operator--(int) & noexcept override { auto tmp = *this; _Base::_curr == _Base::_curr->_prev; return tmp; }
};
template<typename N, typename Alloc = statically_allocated>
requires std::derived_from<N, const_list_node>
template<typename node>
requires std::derived_from<node, const_list_node<node>>
class const_list {
public:
using value_type = N;
using value_type = node;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = value_type *;
using const_pointer = const value_type *;
using iterator = _const_list_iterator<N>;
using const_iterator = _const_const_list_iterator<N>;
using iterator = _const_list_iterator<node>;
using const_iterator = _const_const_list_iterator<node>;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
private:
const_list_node *_start;
const_list_node *_end;
std::size_t _size;
CompileOptional<Alloc, std::is_same_v<Alloc, statically_allocated>> _alloc;
using alloc_defined = decltype(_alloc)::defined;
node *_start = nullptr;
node *_end = nullptr;
std::size_t _size = 0;
public:
@ -110,7 +107,7 @@ namespace cc {
constexpr const_list& operator=(const const_list& other);
constexpr const_list& operator=(const_list&& other);
constexpr const_list& operator=(std::initializer_list<N> init);
constexpr const_list& operator=(std::initializer_list<node> init);
constexpr void assign(size_type count, const value_type& value) noexcept;
template<std::input_iterator InputIt>
@ -208,10 +205,15 @@ namespace cc {
};
template<typename D>
class const_list_node {
static_assert(std::is_base_of_v<const_list_node<D>, D>);
private:
const_list_node *_prev;
const_list_node *_next;
const_list_node *_prev = nullptr;
const_list_node *_next = nullptr;
const_list<D> *_owner = nullptr;
virtual ~const_list_node();
friend class const_list<const_list_node>;
friend class _const_list_iterator_base<const_list_node>;
@ -221,390 +223,44 @@ namespace cc {
template<std::input_iterator InputIt>
const_list(InputIt, InputIt) -> const_list<typename std::iterator_traits<InputIt>::value_type>;
template<typename N1, typename N2, typename Alloc1, typename Alloc2>
constexpr bool operator==(const const_list<N1, Alloc1>& lhs,
const const_list<N2, Alloc2>& rhs)
template<typename N1, typename N2>
constexpr bool operator==(const const_list<N1>& lhs,
const const_list<N2>& rhs)
{
return lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
template<typename N1, typename N2, typename Alloc1, typename Alloc2>
constexpr auto operator<=>(const const_list<N1, Alloc1>& lhs,
const const_list<N2, Alloc2>& rhs)
template<typename N1, typename N2>
constexpr auto operator<=>(const const_list<N1>& lhs,
const const_list<N2>& rhs)
{
return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
template<typename N, typename Alloc>
constexpr void swap(const const_list<N, Alloc>& lhs,
const const_list<N, Alloc>& rhs)
template<typename N>
constexpr void swap(const const_list<N>& lhs,
const const_list<N>& rhs)
{
lhs.swap(rhs);
}
template<typename N, typename Alloc>
constexpr const_list<N, Alloc>::size_type erase(const_list<N, Alloc>& c, const N& value)
template<typename N>
constexpr const_list<N>::size_type erase(const_list<N>& c, const N& value)
{
c.remove(value);
}
template<typename N, typename Alloc, typename Pred>
constexpr const_list<N, Alloc>::size_type erase(const_list<N, Alloc>& c, Pred pred)
template<typename N, typename Pred>
constexpr const_list<N>::size_type erase(const_list<N>& c, Pred pred)
{
c.remove_if(pred);
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr
const_list<N, Alloc>::const_list(const_list::size_type count) noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr
const_list<N, Alloc>::const_list(const_list::size_type count, const value_type &value) noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<std::input_iterator InputIt>
constexpr const_list<N, Alloc>::const_list(InputIt first, InputIt last)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr
const_list<N, Alloc>::const_list(const const_list &other) noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr
const_list<N, Alloc>::const_list(const_list &&other) noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr
const_list<N, Alloc>::const_list(std::initializer_list<value_type> init) noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list<N, Alloc>::~const_list()
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list &
const_list<N, Alloc>::operator=(const const_list &other)
{
return <#initializer#>;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list &
const_list<N, Alloc>::operator=(const_list &&other)
{
return <#initializer#>;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list &
const_list<N, Alloc>::operator=(std::initializer_list<N> init)
{
return <#initializer#>;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::assign(const_list::size_type count, const value_type &value) noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<std::input_iterator InputIt>
constexpr void const_list<N, Alloc>::assign(InputIt first, InputIt last)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::assign(std::initializer_list<value_type> values)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>void const_list<N, Alloc>::clear() noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list::iterator
const_list<N, Alloc>::insert(const_list::const_iterator pos, const value_type &value)
{
return cc::const_list::iterator();
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list::iterator
const_list<N, Alloc>::insert(const_list::const_iterator pos, value_type &&value)
{
return cc::const_list::iterator();
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list::iterator
const_list<N, Alloc>::insert(const_list::const_iterator pos, const_list::size_type count, const value_type &value)
{
return cc::const_list::iterator();
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<std::input_iterator InputIt>
constexpr const_list::iterator
const_list<N, Alloc>::insert(const_list::const_iterator pos, InputIt first, InputIt last)
{
return cc::const_list::iterator();
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list::iterator
const_list<N, Alloc>::insert(const_list::const_iterator pos, std::initializer_list<value_type> values)
{
return cc::const_list::iterator();
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<typename... Args>
constexpr const_list::iterator const_list<N, Alloc>::emplace(const_list::const_iterator pos, Args &&... args)
{
return cc::const_list::iterator();
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list::iterator
const_list<N, Alloc>::erase(const_list::const_iterator pos)
{
return cc::const_list::iterator();
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list::iterator
const_list<N, Alloc>::erase(const_list::const_iterator first, const_list::const_iterator last)
{
return cc::const_list::iterator();
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::push_back(const value_type &value)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void const_list<N, Alloc>::push_back(value_type &&value)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<typename... Args>
constexpr reference const_list<N, Alloc>::emplace_back(Args &&... args)
{
return <#initializer#>;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void const_list<N, Alloc>::pop_back()
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::push_front(const value_type &value)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void const_list<N, Alloc>::push_front(value_type &&value)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<typename... Args>
constexpr reference const_list<N, Alloc>::emplace_front(Args &&... args)
{
return <#initializer#>;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void const_list<N, Alloc>::pop_front()
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::resize(const_list::size_type count)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::resize(const_list::size_type count, const value_type &value)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void const_list<N, Alloc>::swap(const_list &other) noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void const_list<N, Alloc>::merge(const_list &other)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void const_list<N, Alloc>::merge(const_list &&other)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<typename Compare>
constexpr void const_list<N, Alloc>::merge(const_list &other, Compare comp)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<typename Compare>
constexpr void const_list<N, Alloc>::merge(const_list &&other, Compare comp)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::splice(const_list::const_iterator pos, const_list &other)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::splice(const_list::const_iterator pos, const_list &&other)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::splice(const_list::const_iterator pos, const_list &other, const_list::const_iterator it)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::splice(const_list::const_iterator pos, const_list &&other, const_list::const_iterator it)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::splice(const_list::const_iterator pos, const_list &other, const_list::const_iterator first,
const_list::const_iterator last)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void
const_list<N, Alloc>::splice(const_list::const_iterator pos, const_list &&other, const_list::const_iterator first,
const_list::const_iterator last)
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr const_list::size_type
const_list<N, Alloc>::remove(const value_type &value)
{
return 0;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<typename UnaryPredicate>
const_list::size_type const_list<N, Alloc>::remove_if(UnaryPredicate p)
{
return 0;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>void const_list<N, Alloc>::reverse() noexcept
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>const_list::size_type const_list<N, Alloc>::unique()
{
return 0;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<typename BinaryPredicate>
constexpr const_list::size_type const_list<N, Alloc>::unique(BinaryPredicate p)
{
return 0;
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>constexpr void const_list<N, Alloc>::sort()
{
}
template<typename N, typename Alloc>
requires std::derived_from<N, const_list_node>
template<typename Compare>
void const_list<N, Alloc>::sort(Compare comp)
{
}
template<typename D>
const_list_node<D>::~const_list_node() {
_owner->remove(*this);
}
} // cc