1#ifndef DYNAMIC_STORAGE_H
2#define DYNAMIC_STORAGE_H
9template <
typename T, my_
size_t N>
19 _data =
static_cast<T *
>(std::aligned_alloc(
DATA_ALIGNAS, N *
sizeof(T)));
23 throw std::bad_alloc();
37 _data =
static_cast<T *
>(std::aligned_alloc(
DATA_ALIGNAS, N *
sizeof(T)));
39 throw std::bad_alloc();
40 __builtin_memcpy(_data, other._data, N *
sizeof(T));
46 other._data =
nullptr;
56 _data =
static_cast<T *
>(std::aligned_alloc(
DATA_ALIGNAS, N *
sizeof(T)));
58 __builtin_memcpy(_data, other._data, N *
sizeof(T));
70 other._data =
nullptr;
Definition dynamic_storage.h:11
FORCE_INLINE constexpr T * end() noexcept
Definition dynamic_storage.h:85
FORCE_INLINE constexpr T & operator[](my_size_t idx) noexcept
Definition dynamic_storage.h:76
FORCE_INLINE constexpr const T * end() const noexcept
Definition dynamic_storage.h:86
DynamicStorage(const DynamicStorage &other)
Definition dynamic_storage.h:34
FORCE_INLINE constexpr const T * begin() const noexcept
Definition dynamic_storage.h:83
DynamicStorage & operator=(const DynamicStorage &other)
Definition dynamic_storage.h:50
DynamicStorage(DynamicStorage &&other) noexcept
Definition dynamic_storage.h:44
DynamicStorage & operator=(DynamicStorage &&other) noexcept
Definition dynamic_storage.h:64
~DynamicStorage()
Definition dynamic_storage.h:28
FORCE_INLINE constexpr T * begin() noexcept
Definition dynamic_storage.h:82
FORCE_INLINE constexpr T * data() noexcept
Definition dynamic_storage.h:79
DynamicStorage()
Definition dynamic_storage.h:16
FORCE_INLINE constexpr const T & operator[](my_size_t idx) const noexcept
Definition dynamic_storage.h:77
FORCE_INLINE constexpr const T * data() const noexcept
Definition dynamic_storage.h:80
Global configuration for the tesseract tensor library.
#define my_size_t
Size/index type used throughout the library.
Definition config.h:126
#define FORCE_INLINE
Hint the compiler to always inline a function.
Definition config.h:26
constexpr my_size_t DATA_ALIGNAS
Definition microkernel_base.h:145