Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
raw_data_holder.h
1#pragma once
2#include "gaia/config/config.h"
3
4#include <cinttypes>
5
6#include "gaia/mem/data_layout_policy.h"
7
8namespace gaia {
9 namespace mem {
10 namespace detail {
11 template <uint32_t Size, uint32_t Alignment>
13 static_assert(Size > 0);
14
15 GAIA_ALIGNAS(Alignment) uint8_t data[Size];
16
17 constexpr operator uint8_t*() noexcept {
18 return &data[0];
19 }
20
21 constexpr operator const uint8_t*() const noexcept {
22 return &data[0];
23 }
24 };
25
26 template <uint32_t Size>
27 struct raw_data_holder<Size, 0> {
28 static_assert(Size > 0);
29
30 uint8_t data[Size];
31
32 constexpr operator uint8_t*() noexcept {
33 return &data[0];
34 }
35
36 constexpr operator const uint8_t*() const noexcept {
37 return &data[0];
38 }
39 };
40 } // namespace detail
41
42 template <typename T, uint32_t N>
44 } // namespace mem
45} // namespace gaia
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9
Definition raw_data_holder.h:12