|
|
|
|
@ -13,6 +13,7 @@
|
|
|
|
|
|
|
|
|
|
namespace cc {
|
|
|
|
|
|
|
|
|
|
template<typename D>
|
|
|
|
|
class const_list_node;
|
|
|
|
|
|
|
|
|
|
template<typename N>
|
|
|
|
|
@ -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<typename N, typename Alloc = statically_allocated>
|
|
|
|
|
template<typename N>
|
|
|
|
|
requires std::derived_from<N, const_list_node>
|
|
|
|
|
class const_list {
|
|
|
|
|
|
|
|
|
|
@ -86,14 +87,10 @@ namespace cc {
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
@ -208,10 +205,13 @@ namespace cc {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename D>
|
|
|
|
|
class const_list_node {
|
|
|
|
|
static_assert(std::derived_from)
|
|
|
|
|
private:
|
|
|
|
|
const_list_node *_prev;
|
|
|
|
|
const_list_node *_next;
|
|
|
|
|
const_list<D> *_owner;
|
|
|
|
|
|
|
|
|
|
friend class const_list<const_list_node>;
|
|
|
|
|
friend class _const_list_iterator_base<const_list_node>;
|
|
|
|
|
@ -221,390 +221,39 @@ 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)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // cc
|
|
|
|
|
|
|
|
|
|
|