nngn
Loading...
Searching...
No Matches
base.h
Go to the documentation of this file.
1
32#ifndef NNGN_UTILS_ALLOC_BASE_H
33#define NNGN_UTILS_ALLOC_BASE_H
34
35#include <cstddef>
36
37namespace nngn {
38
43
49template<typename T, allocator_opts o> struct allocator_base {};
50
51template<typename T, allocator_opts o>
53 return o.is_always_equal;
54}
55
56template<typename T, allocator_opts o>
58 return !o.is_always_equal;
59}
60
65template<typename T>
67
72template<typename T>
74
75namespace detail {
76
82template<typename A>
83static constexpr bool has_realloc =
84 requires(A a, typename A::pointer p, std::size_t n) {
85 a.reallocate(p, n);
86 };
87
93template<typename A, typename T>
94static constexpr bool has_typed_alloc =
95 requires(A a, typename A::pointer p, std::size_t n, T t) {
96 a.allocate(p, n, t);
97 };
98
99}
100
101}
102
103#endif
local n
Definition dump_lights.lua:5
#define T(f0, f1, f2)
static constexpr bool has_realloc
Checks whether an allocator supports memory relocation.
Definition base.h:83
static constexpr bool has_typed_alloc
Checks whether an allocator supports typed memory allocations.
Definition base.h:94
Definition audio.cpp:7
constexpr bool operator!=(const T< R > &v0, const T< R > &v1)
Definition vec.h:229
constexpr bool operator==(const mat< CRTP, T, N > &m0, const mat< CRTP, T, N > &m1)
Definition mat.h:57
local a
Definition input.lua:35
Base class for allocators, implements a few basic operations.
Definition base.h:49
Configuration object for allocator_base.
Definition base.h:40
bool is_always_equal
Definition base.h:41