32 static_assert(std::is_trivially_constructible_v<T>);
35 std::conditional_t<BUF_SIZE <= std::numeric_limits<uint8_t >::max(), uint8_t,
36 std::conditional_t<BUF_SIZE <= std::numeric_limits<uint16_t>::max(), uint16_t,
37 std::conditional_t<BUF_SIZE <= std::numeric_limits<uint32_t>::max(), uint32_t,
43 assert(size <= BUF_SIZE);
52 template<
typename Range>
56 std::copy(std::begin(range), std::end(range),
begin());
59 [[nodiscard]]
explicit(
false)
operator std::span<T>()
noexcept {
60 return {buffer.data(), sz};
63 [[nodiscard]]
size_t size() const noexcept {
return sz; }
64 [[nodiscard]]
bool empty() const noexcept {
return sz == 0; }
65 [[nodiscard]] T* data() noexcept {
return buffer.data(); }
66 [[nodiscard]]
auto begin() noexcept {
return buffer.begin(); }
67 [[nodiscard]]
auto end() noexcept {
return buffer.begin() + sz; }
69 [[nodiscard]] T& operator[](
size_t index) {
75 return buffer.front();
79 return buffer[sz - 1];
83 std::array<T, BUF_SIZE> buffer;