30 #ifndef WRITABLE_BUFFER_HPP
31 #define WRITABLE_BUFFER_HPP
60 :data(_data), size(_size) {}
63 return {
nullptr, 0 };
67 return data ==
nullptr;
98 :data(_data), size(_size) {}
101 return {
nullptr, 0 };
114 static_assert(
sizeof(T) > 0,
"Empty base type");
116 assert(other.
size %
sizeof(T) == 0);
119 other.
size /
sizeof(T));
123 static_assert(
sizeof(T) > 0,
"Empty base type");
128 return data ==
nullptr;
139 constexpr iterator
end()
const {
143 constexpr const_iterator
cbegin()
const {
147 constexpr const_iterator
cend()
const {
187 return data[size - 1];
216 reference_type result =
front();
constexpr WritableBuffer(std::nullptr_t)
static WritableBuffer< T > FromVoid(WritableBuffer< void > other)
Cast a WritableBuffer to a WritableBuffer.
const_pointer_type const_iterator
constexpr const_iterator cbegin() const
A reference to a memory area that is writable.
void pop_front()
Remove the first element (by moving the head pointer, does not actually modify the buffer)...
reference_type back() const
Returns a reference to the last element.
reference_type shift()
Remove the first element and return a reference to it.
const void * const_pointer_type
const T & const_reference_type
constexpr WritableBuffer(std::nullptr_t)
void pop_back()
Remove the last element (by moving the tail pointer, does not actually modify the buffer)...
void skip_front(size_type n)
constexpr bool IsNull() const
reference_type front() const
Returns a reference to the first element.
constexpr iterator end() const
constexpr WritableBuffer(pointer_type _data, size_type _size)
constexpr WritableBuffer< void > ToVoid() const
constexpr bool IsNull() const
const_pointer_type const_iterator
static constexpr WritableBuffer Null()
constexpr bool IsEmpty() const
constexpr const_iterator cend() const
constexpr iterator begin() const
static constexpr WritableBuffer Null()
constexpr WritableBuffer(pointer_type _data, size_type _size)
reference_type operator[](size_type i) const
constexpr bool IsEmpty() const
const T * const_pointer_type