Compare commits
No commits in common. "af5c9b24541e49848c8f62a0204280da375465c1" and "02f42a0c3b74d24d150ce93bb9b9b1316b6bd4ab" have entirely different histories.
af5c9b2454
...
02f42a0c3b
|
|
@ -1,46 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Patrick Maschek on 22.01.2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef CONST_CONTAINER_COMPILEOPTIONAL_H_
|
|
||||||
#define CONST_CONTAINER_COMPILEOPTIONAL_H_
|
|
||||||
|
|
||||||
#include <type_traits>
|
|
||||||
#include <initializer_list>
|
|
||||||
|
|
||||||
namespace cc {
|
|
||||||
template<typename T, bool Cond = false>
|
|
||||||
class CompileOptional {};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class CompileOptional<T, false> {
|
|
||||||
public:
|
|
||||||
using defined = std::false_type;
|
|
||||||
using value_type = T;
|
|
||||||
|
|
||||||
constexpr CompileOptional() = default;
|
|
||||||
constexpr CompileOptional(const value_type& value) {}
|
|
||||||
template<typename ...Args>
|
|
||||||
constexpr CompileOptional(Args... args) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class CompileOptional<T, true> {
|
|
||||||
public:
|
|
||||||
using defined = std::true_type;
|
|
||||||
using value_type = T;
|
|
||||||
|
|
||||||
constexpr CompileOptional() = default;
|
|
||||||
constexpr CompileOptional(const value_type& value) : _value(value) {}
|
|
||||||
constexpr CompileOptional(value_type&& value) : _value(value) {}
|
|
||||||
template<typename ...Args>
|
|
||||||
constexpr CompileOptional(Args... args) : _value( { std::forward<Args>(args)... } ) {}
|
|
||||||
|
|
||||||
constexpr operator T&() { return _value; }
|
|
||||||
private:
|
|
||||||
T _value;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //CONST_CONTAINER_COMPILEOPTIONAL_H_
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Patrick Maschek on 22.01.2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef UDIFF_ALLOCATOR_H_
|
|
||||||
#define UDIFF_ALLOCATOR_H_
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
namespace cc {
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class allocator_base {
|
|
||||||
public:
|
|
||||||
using value_type = T;
|
|
||||||
using size_type = std::size_t;
|
|
||||||
using difference_type = std::ptrdiff_t;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual constexpr T* allocate(size_type size) = 0;
|
|
||||||
|
|
||||||
virtual constexpr void deallocate(T*, size_type) = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] size_type max_size() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
using statically_allocated = void;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //UDIFF_ALLOCATOR_H_
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include "allocator.h"
|
|
||||||
|
|
||||||
namespace cc {
|
namespace cc {
|
||||||
|
|
||||||
|
|
@ -67,7 +66,7 @@ namespace cc {
|
||||||
constexpr _const_const_list_iterator operator--(int) & noexcept override { auto tmp = *this; _Base::_curr == _Base::_curr->_prev; return tmp; }
|
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>
|
requires std::derived_from<N, const_list_node>
|
||||||
class const_list {
|
class const_list {
|
||||||
|
|
||||||
|
|
@ -215,391 +214,39 @@ namespace cc {
|
||||||
template<std::input_iterator InputIt>
|
template<std::input_iterator InputIt>
|
||||||
const_list(InputIt, InputIt) -> const_list<typename std::iterator_traits<InputIt>::value_type>;
|
const_list(InputIt, InputIt) -> const_list<typename std::iterator_traits<InputIt>::value_type>;
|
||||||
|
|
||||||
template<typename N1, typename N2, typename Alloc1, typename Alloc2>
|
template<typename N1, typename N2>
|
||||||
constexpr bool operator==(const const_list<N1, Alloc1>& lhs,
|
constexpr bool operator==(const const_list<N1>& lhs,
|
||||||
const const_list<N2, Alloc2>& rhs)
|
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>
|
template<typename N1, typename N2>
|
||||||
constexpr auto operator<=>(const const_list<N1, Alloc1>& lhs,
|
constexpr auto operator<=>(const const_list<N1>& lhs,
|
||||||
const const_list<N2, Alloc2>& rhs)
|
const const_list<N2>& rhs)
|
||||||
{
|
{
|
||||||
return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename N, typename Alloc>
|
template<typename N>
|
||||||
constexpr void swap(const const_list<N, Alloc>& lhs,
|
constexpr void swap(const const_list<N>& lhs,
|
||||||
const const_list<N, Alloc>& rhs)
|
const const_list<N>& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename N, typename Alloc>
|
template<typename N>
|
||||||
constexpr const_list<N, Alloc>::size_type erase(const_list<N, Alloc>& c, const N& value)
|
constexpr const_list<N>::size_type erase(const_list<N>& c, const N& value)
|
||||||
{
|
{
|
||||||
c.remove(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename N, typename Alloc, typename Pred>
|
template<typename N, typename Pred>
|
||||||
constexpr const_list<N, Alloc>::size_type erase(const_list<N, Alloc>& c, Pred 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
|
} // cc
|
||||||
|
|
||||||
#endif //UDIFF_CONST_LIST_H_
|
#endif //UDIFF_CONST_LIST_H_
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue