10template <
class T, u
int N>
18 static constexpr uint Capacity =
N;
27 for (
typename std::initializer_list<T>::iterator
i =
inList.begin();
i !=
inList.end(); ++
i)
28 ::new (
reinterpret_cast<T *
>(&mElements[mSize++]))
T(*
i);
34 while (mSize <
inRHS.mSize)
45 for (
T *e =
reinterpret_cast<T *
>(mElements), *end = e + mSize; e < end; ++e)
53 for (
T *e =
reinterpret_cast<T *
>(mElements), *end = e + mSize; e < end; ++e)
77 reinterpret_cast<T &
>(mElements[--mSize]).~
T();
116 return reinterpret_cast<const T *
>(mElements);
121 return reinterpret_cast<const T *
>(mElements + mSize);
128 return reinterpret_cast<T *
>(mElements);
133 return reinterpret_cast<T *
>(mElements + mSize);
138 return reinterpret_cast<const T *
>(mElements);
143 return reinterpret_cast<T *
>(mElements);
150 return reinterpret_cast<T &
>(mElements[
inIdx]);
156 return reinterpret_cast<const T &
>(mElements[
inIdx]);
163 return reinterpret_cast<T &
>(mElements[
inIdx]);
169 return reinterpret_cast<const T &
>(mElements[
inIdx]);
176 return reinterpret_cast<const T &
>(mElements[0]);
182 return reinterpret_cast<T &
>(mElements[0]);
189 return reinterpret_cast<const T &
>(mElements[mSize - 1]);
195 return reinterpret_cast<T &
>(mElements[mSize - 1]);
203 reinterpret_cast<T &
>(mElements[
p]).~
T();
205 memmove(mElements +
p, mElements +
p + 1, (mSize -
p - 1) *
sizeof(
T));
216 reinterpret_cast<T &
>(mElements[
p +
i]).~T();
218 memmove(mElements +
p, mElements +
p +
n, (mSize -
p -
n) *
sizeof(
T));
227 if (
static_cast<const void *
>(
this) !=
static_cast<const void *
>(&
inRHS))
248 if (
static_cast<const void *
>(
this) !=
static_cast<const void *
>(&
inRHS))
265 if (mSize !=
inRHS.mSize)
268 if (!(
reinterpret_cast<const T &
>(mElements[
i]) ==
reinterpret_cast<const T &
>(
inRHS.mElements[
i])))
275 if (mSize !=
inRHS.mSize)
278 if (
reinterpret_cast<const T &
>(mElements[
i]) !=
reinterpret_cast<const T &
>(
inRHS.mElements[
i]))
289 static_assert(
sizeof(
T) ==
sizeof(
Storage),
"Mismatch in size");
290 static_assert(
alignof(
T) ==
alignof(
Storage),
"Mismatch in alignment");
304 template <
class T, JPH::u
int N>
307 size_t operator () (
const JPH::StaticArray<T, N> &
inRHS)
const
312 JPH::HashCombine(
ret,
inRHS.size());
316 JPH::HashCombine(
ret,
t);
std::uint8_t uint8
Definition Core.h:440
unsigned int uint
Definition Core.h:439
#define JPH_NAMESPACE_END
Definition Core.h:367
#define JPH_CLANG_SUPPRESS_WARNING(w)
Definition Core.h:254
#define JPH_NAMESPACE_BEGIN
Definition Core.h:361
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
AllocateFunction Allocate
Definition Memory.cpp:59
Simple variable length array backed by a fixed size buffer.
Definition StaticArray.h:12
StaticArray()=default
Default constructor.
void push_back(const T &inElement)
Add element to the back of the array.
Definition StaticArray.h:59
size_type capacity() const
Returns maximum amount of elements the array can hold.
Definition StaticArray.h:93
iterator end()
Definition StaticArray.h:131
T * data()
Definition StaticArray.h:141
void clear()
Destruct all elements and set length to zero.
Definition StaticArray.h:50
T value_type
Definition StaticArray.h:14
iterator begin()
Definition StaticArray.h:126
StaticArray(std::initializer_list< T > inList)
Constructor from initializer list.
Definition StaticArray.h:24
const T * const_iterator
Definition StaticArray.h:111
T * iterator
Definition StaticArray.h:124
T & front()
Definition StaticArray.h:179
void erase(const_iterator inIter)
Remove one element from the array.
Definition StaticArray.h:199
const_iterator begin() const
Iterators.
Definition StaticArray.h:114
uint size_type
Definition StaticArray.h:16
const T & back() const
Last element in the array.
Definition StaticArray.h:186
const T * data() const
Definition StaticArray.h:136
void emplace_back(A &&... inElement)
Construct element at the back of the array.
Definition StaticArray.h:67
void erase(const_iterator inBegin, const_iterator inEnd)
Remove multiple element from the array.
Definition StaticArray.h:210
T & at(size_type inIdx)
Access element.
Definition StaticArray.h:160
bool empty() const
Returns true if there are no elements in the array.
Definition StaticArray.h:81
StaticArray(const StaticArray< T, N > &inRHS)
Copy constructor.
Definition StaticArray.h:32
const T & front() const
First element in the array.
Definition StaticArray.h:173
T & back()
Definition StaticArray.h:192
const_iterator end() const
Definition StaticArray.h:119
size_type size() const
Returns amount of elements in the array.
Definition StaticArray.h:87
void pop_back()
Remove element from the back of the array.
Definition StaticArray.h:74
void resize(size_type inNewSize)
Resize array to new length.
Definition StaticArray.h:99
const T & at(size_type inIdx) const
Definition StaticArray.h:166
~StaticArray()
Destruct all elements.
Definition StaticArray.h:42
Definition Reference.h:204
Definition StaticArray.h:285