diff --git a/include/allocator.h b/include/allocator.h new file mode 100644 index 0000000..3141899 --- /dev/null +++ b/include/allocator.h @@ -0,0 +1,32 @@ +// +// Created by Patrick Maschek on 22.01.2024. +// + +#ifndef UDIFF_ALLOCATOR_H_ +#define UDIFF_ALLOCATOR_H_ + +#include +#include + +namespace cc { + + template + class allocator { + 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) { + throw std::bad_alloc(); + } + + virtual constexpr void deallocate(T*, size_type) {} + + [[nodiscard]] size_type max_size() { return 0; } + }; + + using statically_allocated = allocator; +} + +#endif //UDIFF_ALLOCATOR_H_ diff --git a/include/const_list.h b/include/const_list.h index dd03e73..6752018 100644 --- a/include/const_list.h +++ b/include/const_list.h @@ -8,6 +8,7 @@ #include #include #include +#include "allocator.h" namespace cc { @@ -66,7 +67,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 { @@ -214,35 +215,35 @@ 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) { } - template - constexpr auto operator<=>(const const_list& lhs, - const const_list& rhs) + template + constexpr auto operator<=>(const const_list& lhs, + const const_list& rhs) { } - template - constexpr void swap(const const_list& lhs, - const const_list& rhs) + template + constexpr void swap(const const_list& lhs, + const const_list& 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) { } - template - constexpr const_list::size_type erase(const_list& c, Pred pred) + template + constexpr const_list::size_type erase(const_list& c, Pred pred) { }