mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 05:43:12 +01:00
Dep/G3D: Add static assert checks for Array functions being used with non-POD types
This commit is contained in:
@@ -346,6 +346,7 @@ public:
|
||||
|
||||
/** Resizes this to match the size of \a other and then copies the data from other using memcpy. This is only safe for POD types */
|
||||
void copyPOD(const Array<T>& other) {
|
||||
static_assert(std::is_pod<T>::value, "copyPOD called on non-POD type");
|
||||
if (numAllocated < other.num) {
|
||||
m_memoryManager->free(data);
|
||||
data = NULL;
|
||||
@@ -364,6 +365,7 @@ public:
|
||||
/** Resizes this to just barely match the size of \a other + itself and then copies the data to the end of the array from other using memcpy.
|
||||
This is only safe for POD types */
|
||||
void appendPOD(const Array<T>& other) {
|
||||
static_assert(std::is_pod<T>::value, "appendPOD called on non-POD type");
|
||||
const size_t oldSize = num;
|
||||
num += other.num;
|
||||
if (numAllocated < num) {
|
||||
|
||||
Reference in New Issue
Block a user