diff options
author | jackpoz <giacomopoz@gmail.com> | 2017-11-11 16:30:45 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-02-06 21:41:51 +0100 |
commit | c44478664a0b9ac47e0779b433f08efc38c64022 (patch) | |
tree | ceaa7574b586ef39ab7c1b20eb3c7a48fe1ef8fa | |
parent | dffef65da2863078e48972e7dc0ea225d39389e9 (diff) |
Dep/G3D: Add static assert checks for Array functions being used with non-POD types
(cherry picked from commit f017b1d470aec0ca4918e059343d57de99fb2254)
-rw-r--r-- | dep/g3dlite/include/G3D/Array.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/dep/g3dlite/include/G3D/Array.h b/dep/g3dlite/include/G3D/Array.h index c562f5c920f..c86b20fd7e9 100644 --- a/dep/g3dlite/include/G3D/Array.h +++ b/dep/g3dlite/include/G3D/Array.h @@ -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) { |