Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_memory_utils.hh')
-rw-r--r--source/blender/blenlib/BLI_memory_utils.hh15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_memory_utils.hh b/source/blender/blenlib/BLI_memory_utils.hh
index de9fc956bfb..81792e2101c 100644
--- a/source/blender/blenlib/BLI_memory_utils.hh
+++ b/source/blender/blenlib/BLI_memory_utils.hh
@@ -22,6 +22,7 @@
*/
#include <memory>
+#include <new>
#include "BLI_utildefines.h"
@@ -39,13 +40,13 @@ namespace blender {
template<typename T> void default_construct_n(T *ptr, uint n)
{
/* This is not strictly necessary, because the loop below will be optimized away anyway. It is
- * nice to make behavior this explicitely, though. */
+ * nice to make behavior this explicitly, though. */
if (std::is_trivially_constructible<T>::value) {
return;
}
for (uint i = 0; i < n; i++) {
- new (ptr + i) T;
+ new ((void *)(ptr + i)) T;
}
}
@@ -61,7 +62,7 @@ template<typename T> void default_construct_n(T *ptr, uint n)
template<typename T> void destruct_n(T *ptr, uint n)
{
/* This is not strictly necessary, because the loop below will be optimized away anyway. It is
- * nice to make behavior this explicitely, though. */
+ * nice to make behavior this explicitly, though. */
if (std::is_trivially_destructible<T>::value) {
return;
}
@@ -101,7 +102,7 @@ template<typename T> void initialized_copy_n(const T *src, uint n, T *dst)
template<typename T> void uninitialized_copy_n(const T *src, uint n, T *dst)
{
for (uint i = 0; i < n; i++) {
- new (dst + i) T(src[i]);
+ new ((void *)(dst + i)) T(src[i]);
}
}
@@ -135,7 +136,7 @@ template<typename T> void initialized_move_n(T *src, uint n, T *dst)
template<typename T> void uninitialized_move_n(T *src, uint n, T *dst)
{
for (uint i = 0; i < n; i++) {
- new (dst + i) T(std::move(src[i]));
+ new ((void *)(dst + i)) T(std::move(src[i]));
}
}
@@ -162,7 +163,7 @@ template<typename T> void initialized_relocate_n(T *src, uint n, T *dst)
*
* Before:
* src: initialized
- * dst: uinitialized
+ * dst: uninitialized
* After:
* src: uninitialized
* dst: initialized
@@ -199,7 +200,7 @@ template<typename T> void initialized_fill_n(T *dst, uint n, const T &value)
template<typename T> void uninitialized_fill_n(T *dst, uint n, const T &value)
{
for (uint i = 0; i < n; i++) {
- new (dst + i) T(value);
+ new ((void *)(dst + i)) T(value);
}
}