20namespace pw::containers {
35template <
size_t kAlignment,
size_t kSizeBytes>
38 using value_type = std::byte;
39 using size_type = size_t;
40 using pointer = value_type*;
41 using const_pointer =
const value_type*;
43 constexpr Storage() : buffer_{} {}
51 constexpr pointer data() {
return buffer_.data(); }
52 constexpr const_pointer data()
const {
return buffer_.data(); }
55 constexpr size_type
size()
const {
return buffer_.size(); }
57 [[nodiscard]]
constexpr bool empty()
const {
return buffer_.empty(); }
59 constexpr void fill(std::byte value) {
60 pw::fill_n(buffer_.data(), buffer_.size(), value);
64 alignas(kAlignment) std::array<std::byte, kSizeBytes> buffer_;
72template <
typename T,
size_t kCount = 1>
85template <
typename T,
size_t kCapacity>
constexpr size_type size() const
The size of the storage in bytes.
Definition: storage.h:55
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
constexpr size_t kExternalStorage
Reserved capacity value for container specializations with external storage.
Definition: storage.h:76