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
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-06-11 16:36:01 +0300
committerJacques Lucke <jacques@blender.org>2020-06-11 16:37:09 +0300
commite44045745d51622513f5733686f78db65d160263 (patch)
treefbf2f58ccf6243e3b30bd06e31f4e349d7692439 /source
parente22098616c25c00786409fbf4e3229456f6b3807 (diff)
BLI: don't pass const pointers to placement new operator
This resulted in compile errors.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_linear_allocator.hh2
-rw-r--r--source/blender/blenlib/BLI_map.hh2
-rw-r--r--source/blender/blenlib/BLI_map_slots.hh24
-rw-r--r--source/blender/blenlib/BLI_memory_utils.hh8
-rw-r--r--source/blender/blenlib/BLI_optional.hh8
-rw-r--r--source/blender/blenlib/BLI_set_slots.hh16
6 files changed, 30 insertions, 30 deletions
diff --git a/source/blender/blenlib/BLI_linear_allocator.hh b/source/blender/blenlib/BLI_linear_allocator.hh
index f968f9f15ce..2a0dc939cb9 100644
--- a/source/blender/blenlib/BLI_linear_allocator.hh
+++ b/source/blender/blenlib/BLI_linear_allocator.hh
@@ -171,7 +171,7 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya
MutableSpan<T *> pointers = void_pointers.cast<T *>();
for (uint i : IndexRange(n)) {
- new (pointers[i]) T(std::forward<Args>(args)...);
+ new ((void *)pointers[i]) T(std::forward<Args>(args)...);
}
return pointers;
diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh
index 4fc9f98d835..f20f7b47647 100644
--- a/source/blender/blenlib/BLI_map.hh
+++ b/source/blender/blenlib/BLI_map.hh
@@ -1175,7 +1175,7 @@ class Map {
bool add_overwrite__impl(ForwardKey &&key, ForwardValue &&value, uint32_t hash)
{
auto create_func = [&](Value *ptr) {
- new (ptr) Value(std::forward<ForwardValue>(value));
+ new ((void *)ptr) Value(std::forward<ForwardValue>(value));
return true;
};
auto modify_func = [&](Value *ptr) {
diff --git a/source/blender/blenlib/BLI_map_slots.hh b/source/blender/blenlib/BLI_map_slots.hh
index 9ea2c4cad89..97d3baf0c83 100644
--- a/source/blender/blenlib/BLI_map_slots.hh
+++ b/source/blender/blenlib/BLI_map_slots.hh
@@ -84,8 +84,8 @@ template<typename Key, typename Value> class SimpleMapSlot {
{
m_state = other.m_state;
if (other.m_state == Occupied) {
- new (this->key()) Key(*other.key());
- new (this->value()) Value(*other.value());
+ new ((void *)this->key()) Key(*other.key());
+ new ((void *)this->value()) Value(*other.value());
}
}
@@ -98,8 +98,8 @@ template<typename Key, typename Value> class SimpleMapSlot {
{
m_state = other.m_state;
if (other.m_state == Occupied) {
- new (this->key()) Key(std::move(*other.key()));
- new (this->value()) Value(std::move(*other.value()));
+ new ((void *)this->key()) Key(std::move(*other.key()));
+ new ((void *)this->value()) Value(std::move(*other.value()));
}
}
@@ -170,8 +170,8 @@ template<typename Key, typename Value> class SimpleMapSlot {
BLI_assert(!this->is_occupied());
BLI_assert(other.is_occupied());
m_state = Occupied;
- new (this->key()) Key(std::move(*other.key()));
- new (this->value()) Value(std::move(*other.value()));
+ new ((void *)this->key()) Key(std::move(*other.key()));
+ new ((void *)this->value()) Value(std::move(*other.value()));
other.key()->~Key();
other.value()->~Value();
}
@@ -198,7 +198,7 @@ template<typename Key, typename Value> class SimpleMapSlot {
{
BLI_assert(!this->is_occupied());
this->occupy_without_value(std::forward<ForwardKey>(key), hash);
- new (this->value()) Value(std::forward<ForwardValue>(value));
+ new ((void *)this->value()) Value(std::forward<ForwardValue>(value));
}
/**
@@ -209,7 +209,7 @@ template<typename Key, typename Value> class SimpleMapSlot {
{
BLI_assert(!this->is_occupied());
m_state = Occupied;
- new (this->key()) Key(std::forward<ForwardKey>(key));
+ new ((void *)this->key()) Key(std::forward<ForwardKey>(key));
}
/**
@@ -251,14 +251,14 @@ template<typename Key, typename Value, typename KeyInfo> class IntrusiveMapSlot
IntrusiveMapSlot(const IntrusiveMapSlot &other) : m_key(other.m_key)
{
if (KeyInfo::is_not_empty_or_removed(m_key)) {
- new (this->value()) Value(*other.value());
+ new ((void *)this->value()) Value(*other.value());
}
}
IntrusiveMapSlot(IntrusiveMapSlot &&other) noexcept : m_key(other.m_key)
{
if (KeyInfo::is_not_empty_or_removed(m_key)) {
- new (this->value()) Value(std::move(*other.value()));
+ new ((void *)this->value()) Value(std::move(*other.value()));
}
}
@@ -303,7 +303,7 @@ template<typename Key, typename Value, typename KeyInfo> class IntrusiveMapSlot
BLI_assert(!this->is_occupied());
BLI_assert(other.is_occupied());
m_key = std::move(other.m_key);
- new (this->value()) Value(std::move(*other.value()));
+ new ((void *)this->value()) Value(std::move(*other.value()));
other.m_key.~Key();
other.value()->~Value();
}
@@ -321,7 +321,7 @@ template<typename Key, typename Value, typename KeyInfo> class IntrusiveMapSlot
BLI_assert(!this->is_occupied());
BLI_assert(KeyInfo::is_not_empty_or_removed(key));
this->occupy_without_value(std::forward<ForwardKey>(key), hash);
- new (this->value()) Value(std::forward<ForwardValue>(value));
+ new ((void *)this->value()) Value(std::forward<ForwardValue>(value));
}
template<typename ForwardKey> void occupy_without_value(ForwardKey &&key, uint32_t UNUSED(hash))
diff --git a/source/blender/blenlib/BLI_memory_utils.hh b/source/blender/blenlib/BLI_memory_utils.hh
index c317376fe8e..55dca98fb07 100644
--- a/source/blender/blenlib/BLI_memory_utils.hh
+++ b/source/blender/blenlib/BLI_memory_utils.hh
@@ -46,7 +46,7 @@ template<typename T> void default_construct_n(T *ptr, uint n)
}
for (uint i = 0; i < n; i++) {
- new (ptr + i) T;
+ new ((void *)(ptr + i)) T;
}
}
@@ -102,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]);
}
}
@@ -136,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]));
}
}
@@ -200,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);
}
}
diff --git a/source/blender/blenlib/BLI_optional.hh b/source/blender/blenlib/BLI_optional.hh
index b5f98d6fa97..2e6b66d0eac 100644
--- a/source/blender/blenlib/BLI_optional.hh
+++ b/source/blender/blenlib/BLI_optional.hh
@@ -121,7 +121,7 @@ template<typename T> class Optional {
this->value() = value;
}
else {
- new (this->value_ptr()) T(value);
+ new ((void *)this->value_ptr()) T(value);
m_set = true;
}
}
@@ -132,7 +132,7 @@ template<typename T> class Optional {
this->value() = std::move(value);
}
else {
- new (this->value_ptr()) T(std::move(value));
+ new ((void *)this->value_ptr()) T(std::move(value));
m_set = true;
}
}
@@ -140,14 +140,14 @@ template<typename T> class Optional {
void set_new(const T &value)
{
BLI_assert(!m_set);
- new (this->value_ptr()) T(value);
+ new ((void *)this->value_ptr()) T(value);
m_set = true;
}
void set_new(T &&value)
{
BLI_assert(!m_set);
- new (this->value_ptr()) T(std::move(value));
+ new ((void *)this->value_ptr()) T(std::move(value));
m_set = true;
}
diff --git a/source/blender/blenlib/BLI_set_slots.hh b/source/blender/blenlib/BLI_set_slots.hh
index 15f56f2450e..581e70ce628 100644
--- a/source/blender/blenlib/BLI_set_slots.hh
+++ b/source/blender/blenlib/BLI_set_slots.hh
@@ -80,7 +80,7 @@ template<typename Key> class SimpleSetSlot {
{
m_state = other.m_state;
if (other.m_state == Occupied) {
- new (this->key()) Key(*other.key());
+ new ((void *)this->key()) Key(*other.key());
}
}
@@ -93,7 +93,7 @@ template<typename Key> class SimpleSetSlot {
{
m_state = other.m_state;
if (other.m_state == Occupied) {
- new (this->key()) Key(std::move(*other.key()));
+ new ((void *)this->key()) Key(std::move(*other.key()));
}
}
@@ -148,7 +148,7 @@ template<typename Key> class SimpleSetSlot {
BLI_assert(!this->is_occupied());
BLI_assert(other.is_occupied());
m_state = Occupied;
- new (this->key()) Key(std::move(*other.key()));
+ new ((void *)this->key()) Key(std::move(*other.key()));
other.key()->~Key();
}
@@ -173,7 +173,7 @@ template<typename Key> class SimpleSetSlot {
{
BLI_assert(!this->is_occupied());
m_state = Occupied;
- new (this->key()) Key(std::forward<ForwardKey>(key));
+ new ((void *)this->key()) Key(std::forward<ForwardKey>(key));
}
/**
@@ -221,7 +221,7 @@ template<typename Key> class HashedSetSlot {
m_state = other.m_state;
if (other.m_state == Occupied) {
m_hash = other.m_hash;
- new (this->key()) Key(*other.key());
+ new ((void *)this->key()) Key(*other.key());
}
}
@@ -230,7 +230,7 @@ template<typename Key> class HashedSetSlot {
m_state = other.m_state;
if (other.m_state == Occupied) {
m_hash = other.m_hash;
- new (this->key()) Key(std::move(*other.key()));
+ new ((void *)this->key()) Key(std::move(*other.key()));
}
}
@@ -266,7 +266,7 @@ template<typename Key> class HashedSetSlot {
BLI_assert(other.is_occupied());
m_state = Occupied;
m_hash = hash;
- new (this->key()) Key(std::move(*other.key()));
+ new ((void *)this->key()) Key(std::move(*other.key()));
other.key()->~Key();
}
@@ -287,7 +287,7 @@ template<typename Key> class HashedSetSlot {
BLI_assert(!this->is_occupied());
m_state = Occupied;
m_hash = hash;
- new (this->key()) Key(std::forward<ForwardKey>(key));
+ new ((void *)this->key()) Key(std::forward<ForwardKey>(key));
}
void remove()