BLI: don't pass const pointers to placement new operator
This resulted in compile errors.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user