tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
static_storage.h
Go to the documentation of this file.
1#ifndef STATIC_STORAGE_H
2#define STATIC_STORAGE_H
3
4#include "config.h" // for my_size_t
5#include "fused/microkernels/microkernel_base.h" // for DATA_ALIGNAS
6
7template <typename T, my_size_t Size>
9{
10 alignas(DATA_ALIGNAS) T _data[Size];
11
12public:
13 FORCE_INLINE constexpr T &operator[](my_size_t idx) noexcept { return _data[idx]; }
14 FORCE_INLINE constexpr const T &operator[](my_size_t idx) const noexcept { return _data[idx]; }
15
16 FORCE_INLINE constexpr T *data() noexcept { return _data; }
17 FORCE_INLINE constexpr const T *data() const noexcept { return _data; }
18
19 FORCE_INLINE constexpr T *begin() noexcept { return _data; }
20 FORCE_INLINE constexpr const T *begin() const noexcept { return _data; }
21
22 FORCE_INLINE constexpr T *end() noexcept { return _data + Size; }
23 FORCE_INLINE constexpr const T *end() const noexcept { return _data + Size; }
24};
25#endif // STATIC_STORAGE_H
Definition static_storage.h:9
FORCE_INLINE constexpr T & operator[](my_size_t idx) noexcept
Definition static_storage.h:13
FORCE_INLINE constexpr T * begin() noexcept
Definition static_storage.h:19
FORCE_INLINE constexpr const T & operator[](my_size_t idx) const noexcept
Definition static_storage.h:14
FORCE_INLINE constexpr const T * end() const noexcept
Definition static_storage.h:23
FORCE_INLINE constexpr T * end() noexcept
Definition static_storage.h:22
FORCE_INLINE constexpr const T * begin() const noexcept
Definition static_storage.h:20
FORCE_INLINE constexpr T * data() noexcept
Definition static_storage.h:16
FORCE_INLINE constexpr const T * data() const noexcept
Definition static_storage.h:17
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