Go to the documentation of this file. 1 #ifndef EAGINE_BUFFER_DATA_HPP
9 #define EAGINE_BUFFER_DATA_HPP
18 class buffer_data_spec {
20 buffer_size<S> _size{};
21 const void* _data{
nullptr};
24 buffer_data_spec() noexcept = default;
26 buffer_data_spec(const memory::
block& blk) noexcept
27 : _size(S(blk.size()))
28 , _data(blk.data()) {}
30 template <
typename T, span_
size_t N>
31 buffer_data_spec(
const T (&data)[N]) noexcept
32 : _size(type_identity<T>(), N)
33 , _data(
static_cast<const void*
>(data)) {}
36 buffer_data_spec(
const T* data,
span_size_t n) noexcept
37 : _size(type_identity<T>(), n)
41 buffer_data_spec(span<T> av) noexcept
45 auto empty() const noexcept ->
bool {
46 return _size.get() == 0;
49 auto size() const noexcept -> buffer_size<S> {
53 auto data() const noexcept -> const
void* {
57 auto view() const noexcept ->
span<const
byte> {
59 static_cast<const byte*
>(_data),
static_cast<std::ptrdiff_t
>(_size)};
65 #endif // EAGINE_BUFFER_DATA_HPP
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
Common code is placed in this namespace.
Definition: eagine.hpp:21
static constexpr auto view(T *addr, S size) noexcept -> const_span< T >
Creates a view starting at the specified pointer and specified length.
Definition: span.hpp:458
basic_block< false > block
Alias for non-const byte memory span.
Definition: block.hpp:27
basic_span< T, T *, S > span
Default alias for basic memory spans with native pointer type.
Definition: span.hpp:415