21namespace pw::containers {
38template <
size_t kAlignment,
size_t kSizeBytes>
41 using value_type = std::byte;
42 using size_type = size_t;
43 using pointer = value_type*;
44 using const_pointer =
const value_type*;
46 constexpr Storage() : buffer_{} {}
54 constexpr pointer data() {
return buffer_.data(); }
55 constexpr const_pointer data()
const {
return buffer_.data(); }
58 constexpr size_type
size()
const {
return buffer_.size(); }
60 [[nodiscard]]
constexpr bool empty()
const {
return buffer_.empty(); }
62 constexpr void fill(std::byte value) {
63 pw::fill_n(buffer_.data(), buffer_.size(), value);
67 alignas(kAlignment) std::array<std::byte, kSizeBytes> buffer_;
75template <
typename T,
size_t kCount = 1>
85template <
size_t kAlignment,
size_t kSizeBytes>
99template <
typename T,
size_t kCount = 1>
constexpr size_type size() const
The size of the storage in bytes.
Definition: storage.h:58
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:420
constexpr size_t kExternalStorage
Reserved capacity value for container specializations with external storage.
Definition: storage.h:79