18 Buffer() : i(b.begin()) {}
19 Buffer(
const std::byte* beg,
const std::byte* end) : b(beg, end), i(b.begin()) {}
20 Buffer(
const std::vector<std::byte>& v) : b(v), i(b.begin()) {}
21 Buffer(Buffer& o,
bool adopt) : b(o.b, adopt), i(b.begin()) {}
23 Buffer(Buffer&& other) noexcept : b(std::move(other.b)), i(other.i) { other.i = other.b.begin(); }
25 Buffer& operator=(Buffer&& other)
noexcept
29 b = std::move(other.b);
31 other.i = other.b.begin();
36 Buffer(
const Buffer&) =
delete;
37 Buffer& operator=(
const Buffer&) =
delete;
39 void swapBuffer(Buffer& other)
noexcept
42 std::swap(i, other.i);
45 class ICE_API Container
51 using value_type = std::byte;
52 using iterator = std::byte*;
53 using const_iterator =
const std::byte*;
54 using reference = std::byte&;
55 using const_reference =
const std::byte&;
56 using pointer = std::byte*;
57 using size_type = size_t;
60 Container(const_iterator, const_iterator) noexcept;
61 Container(const std::vector<value_type>&) noexcept;
62 Container(Container&,
bool) noexcept;
64 Container(Container&&) noexcept;
65 Container& operator=(Container&&) noexcept;
67 Container(const Container&) = delete;
68 Container& operator=(const Container&) = delete;
72 iterator begin() {
return _buf; }
74 [[nodiscard]] const_iterator begin()
const {
return _buf; }
76 iterator end() {
return _buf + _size; }
78 [[nodiscard]] const_iterator end()
const {
return _buf + _size; }
80 [[nodiscard]] size_type size()
const {
return _size; }
82 [[nodiscard]]
bool empty()
const {
return !_size; }
84 [[nodiscard]]
bool ownsMemory() const noexcept {
return _owned; }
86 void swap(Container&)
noexcept;
90 void resize(size_type n)
96 else if (n > _capacity)
105 if (_size > 0 && _size * 2 < _capacity)
113 if (++_shrinkCounter > 2)
126 void push_back(value_type v)
132 reference operator[](size_type n)
138 const_reference operator[](size_type n)
const
145 void reserve(size_type);
155 Container::iterator i;