18#include "pw_allocator/unique_ptr.h"
21namespace pw::containers {
36template <
size_t kAlignment,
size_t kSizeBytes>
39 using value_type = std::byte;
40 using size_type = size_t;
41 using pointer = value_type*;
42 using const_pointer =
const value_type*;
44 constexpr Storage() : buffer_{} {}
52 constexpr pointer data() {
return buffer_.data(); }
53 constexpr const_pointer data()
const {
return buffer_.data(); }
56 constexpr size_type
size()
const {
return buffer_.size(); }
58 [[nodiscard]]
constexpr bool empty()
const {
return buffer_.empty(); }
60 constexpr void fill(std::byte value) {
61 pw::fill_n(buffer_.data(), buffer_.size(), value);
65 alignas(kAlignment) std::array<std::byte, kSizeBytes> buffer_;
73template <
typename T,
size_t kCount = 1>
87template <
typename T,
size_t kCapacity>
Definition: unique_ptr.h:43
constexpr size_type size() const
The size of the storage in bytes.
Definition: storage.h:56
constexpr size_t kAllocatedStorage
Definition: storage.h:78
constexpr It fill_n(It begin, Size count, const T &value)
constexpr backport of <algorithm>'s std::fill_n for C++17.
Definition: algorithm.h:413