diff --git a/Jolt/Core/Array.h b/Jolt/Core/Array.h index dd0a9e1ea..a273f4eb5 100644 --- a/Jolt/Core/Array.h +++ b/Jolt/Core/Array.h @@ -59,7 +59,7 @@ class [[nodiscard]] Array : private Allocator { for (T *destination_end = inDestination + inCount; inDestination < destination_end; ++inDestination, ++inSource) { - ::new (inDestination) T(std::move(*inSource)); + new (inDestination) T(std::move(*inSource)); inSource->~T(); } } @@ -67,7 +67,7 @@ class [[nodiscard]] Array : private Allocator { for (T *destination = inDestination + inCount - 1, *source = inSource + inCount - 1; destination >= inDestination; --destination, --source) { - ::new (destination) T(std::move(*source)); + new (destination) T(std::move(*source)); source->~T(); } } @@ -124,7 +124,7 @@ class [[nodiscard]] Array : private Allocator if constexpr (!std::is_trivially_constructible()) for (T *element = mElements + mSize, *element_end = mElements + inNewSize; element < element_end; ++element) - ::new (element) T; + new (element) T; mSize = inNewSize; } @@ -137,7 +137,7 @@ class [[nodiscard]] Array : private Allocator reserve(inNewSize); for (T *element = mElements + mSize, *element_end = mElements + inNewSize; element < element_end; ++element) - ::new (element) T(inValue); + new (element) T(inValue); mSize = inNewSize; } @@ -187,7 +187,7 @@ class [[nodiscard]] Array : private Allocator reserve(size_type(std::distance(inBegin, inEnd))); for (Iterator element = inBegin; element != inEnd; ++element) - ::new (&mElements[mSize++]) T(*element); + new (&mElements[mSize++]) T(*element); } /// Replace the contents of this array with inList @@ -197,7 +197,7 @@ class [[nodiscard]] Array : private Allocator reserve(size_type(inList.size())); for (const T &v : inList) - ::new (&mElements[mSize++]) T(v); + new (&mElements[mSize++]) T(v); } /// Default constructor @@ -281,7 +281,7 @@ class [[nodiscard]] Array : private Allocator grow(); T *element = mElements + mSize++; - ::new (element) T(inValue); + new (element) T(inValue); } inline void push_back(T &&inValue) @@ -289,7 +289,7 @@ class [[nodiscard]] Array : private Allocator grow(); T *element = mElements + mSize++; - ::new (element) T(std::move(inValue)); + new (element) T(std::move(inValue)); } /// Construct element at the back of the array @@ -299,7 +299,7 @@ class [[nodiscard]] Array : private Allocator grow(); T *element = mElements + mSize++; - ::new (element) T(std::forward(inValue)...); + new (element) T(std::forward(inValue)...); return *element; } @@ -365,7 +365,7 @@ class [[nodiscard]] Array : private Allocator move(element_end, element_begin, mSize - first_element); for (T *element = element_begin; element < element_end; ++element, ++inBegin) - ::new (element) T(*inBegin); + new (element) T(*inBegin); mSize += num_elements; } @@ -383,7 +383,7 @@ class [[nodiscard]] Array : private Allocator T *element = mElements + first_element; move(element + 1, element, mSize - first_element); - ::new (element) T(inValue); + new (element) T(inValue); mSize++; } diff --git a/Jolt/Core/ByteBuffer.h b/Jolt/Core/ByteBuffer.h index 48d19703f..610b15155 100644 --- a/Jolt/Core/ByteBuffer.h +++ b/Jolt/Core/ByteBuffer.h @@ -41,7 +41,7 @@ class ByteBuffer : public ByteBufferVector // Construct elements for (Type *d = data, *d_end = data + inSize; d < d_end; ++d) - ::new (d) Type; + new (d) Type; // Return pointer return data; diff --git a/Jolt/Core/FixedSizeFreeList.inl b/Jolt/Core/FixedSizeFreeList.inl index 29d4734c0..3fe40b892 100644 --- a/Jolt/Core/FixedSizeFreeList.inl +++ b/Jolt/Core/FixedSizeFreeList.inl @@ -79,7 +79,7 @@ uint32 FixedSizeFreeList::ConstructObject(Parameters &&... inParameters) // Allocation successful JPH_IF_ENABLE_ASSERTS(mNumFreeObjects.fetch_sub(1, memory_order_relaxed);) ObjectStorage &storage = GetStorage(first_free); - ::new (&storage.mObject) Object(std::forward(inParameters)...); + new (&storage.mObject) Object(std::forward(inParameters)...); storage.mNextFreeObject.store(first_free, memory_order_release); return first_free; } @@ -97,7 +97,7 @@ uint32 FixedSizeFreeList::ConstructObject(Parameters &&... inParameters) // Allocation successful JPH_IF_ENABLE_ASSERTS(mNumFreeObjects.fetch_sub(1, memory_order_relaxed);) ObjectStorage &storage = GetStorage(first_free); - ::new (&storage.mObject) Object(std::forward(inParameters)...); + new (&storage.mObject) Object(std::forward(inParameters)...); storage.mNextFreeObject.store(first_free, memory_order_release); return first_free; } diff --git a/Jolt/Core/HashTable.h b/Jolt/Core/HashTable.h index baca08255..9b69f9d08 100644 --- a/Jolt/Core/HashTable.h +++ b/Jolt/Core/HashTable.h @@ -175,7 +175,7 @@ class HashTable uint index = 0; for (const uint8 *control = mControl, *control_end = mControl + mMaxSize; control != control_end; ++control, ++index) if (*control & cBucketUsed) - ::new (mData + index) KeyValue(inRHS.mData[index]); + new (mData + index) KeyValue(inRHS.mData[index]); mSize = inRHS.mSize; } @@ -216,7 +216,7 @@ class HashTable KeyValue *element = old_data + i; JPH_IF_ENABLE_ASSERTS(bool inserted =) InsertKey(HashTableDetail::sGetKey(*element), index); JPH_ASSERT(inserted); - ::new (mData + index) KeyValue(std::move(*element)); + new (mData + index) KeyValue(std::move(*element)); element->~KeyValue(); } @@ -601,7 +601,7 @@ class HashTable size_type index; bool inserted = InsertKey(HashTableDetail::sGetKey(inValue), index); if (inserted) - ::new (mData + index) KeyValue(inValue); + new (mData + index) KeyValue(inValue); return std::make_pair(iterator(this, index), inserted); } @@ -800,7 +800,7 @@ class HashTable // There's an empty bucket, move us there SetControlValue(dst, src_control); SetControlValue(src, cBucketEmpty); - ::new (mData + dst) KeyValue(std::move(mData[src])); + new (mData + dst) KeyValue(std::move(mData[src])); mData[src].~KeyValue(); break; } diff --git a/Jolt/Core/Result.h b/Jolt/Core/Result.h index ad2eab164..282b35adb 100644 --- a/Jolt/Core/Result.h +++ b/Jolt/Core/Result.h @@ -21,11 +21,11 @@ class Result switch (inRHS.mState) { case EState::Valid: - ::new (&mResult) Type (inRHS.mResult); + new (&mResult) Type (inRHS.mResult); break; case EState::Error: - ::new (&mError) String(inRHS.mError); + new (&mError) String(inRHS.mError); break; case EState::Invalid: @@ -40,11 +40,11 @@ class Result switch (inRHS.mState) { case EState::Valid: - ::new (&mResult) Type (std::move(inRHS.mResult)); + new (&mResult) Type (std::move(inRHS.mResult)); break; case EState::Error: - ::new (&mError) String(std::move(inRHS.mError)); + new (&mError) String(std::move(inRHS.mError)); break; case EState::Invalid: @@ -67,11 +67,11 @@ class Result switch (inRHS.mState) { case EState::Valid: - ::new (&mResult) Type (inRHS.mResult); + new (&mResult) Type (inRHS.mResult); break; case EState::Error: - ::new (&mError) String(inRHS.mError); + new (&mError) String(inRHS.mError); break; case EState::Invalid: @@ -91,11 +91,11 @@ class Result switch (inRHS.mState) { case EState::Valid: - ::new (&mResult) Type (std::move(inRHS.mResult)); + new (&mResult) Type (std::move(inRHS.mResult)); break; case EState::Error: - ::new (&mError) String(std::move(inRHS.mError)); + new (&mError) String(std::move(inRHS.mError)); break; case EState::Invalid: @@ -137,10 +137,10 @@ class Result const Type & Get() const { JPH_ASSERT(IsValid()); return mResult; } /// Set the result value - void Set(const Type &inResult) { Clear(); ::new (&mResult) Type(inResult); mState = EState::Valid; } + void Set(const Type &inResult) { Clear(); new (&mResult) Type(inResult); mState = EState::Valid; } /// Set the result value (move value) - void Set(Type &&inResult) { Clear(); ::new (&mResult) Type(std::move(inResult)); mState = EState::Valid; } + void Set(Type &&inResult) { Clear(); new (&mResult) Type(std::move(inResult)); mState = EState::Valid; } /// Check if we had an error bool HasError() const { return mState == EState::Error; } @@ -149,9 +149,9 @@ class Result const String & GetError() const { JPH_ASSERT(HasError()); return mError; } /// Set an error value - void SetError(const char *inError) { Clear(); ::new (&mError) String(inError); mState = EState::Error; } - void SetError(const string_view &inError) { Clear(); ::new (&mError) String(inError); mState = EState::Error; } - void SetError(String &&inError) { Clear(); ::new (&mError) String(std::move(inError)); mState = EState::Error; } + void SetError(const char *inError) { Clear(); new (&mError) String(inError); mState = EState::Error; } + void SetError(const string_view &inError) { Clear(); new (&mError) String(inError); mState = EState::Error; } + void SetError(String &&inError) { Clear(); new (&mError) String(std::move(inError)); mState = EState::Error; } private: union diff --git a/Jolt/Core/StaticArray.h b/Jolt/Core/StaticArray.h index fddaaa37a..421bf680f 100644 --- a/Jolt/Core/StaticArray.h +++ b/Jolt/Core/StaticArray.h @@ -27,7 +27,7 @@ class [[nodiscard]] StaticArray { JPH_ASSERT(inList.size() <= N); for (const T &v : inList) - ::new (reinterpret_cast(&mElements[mSize++])) T(v); + new (reinterpret_cast(&mElements[mSize++])) T(v); } /// Copy constructor @@ -35,7 +35,7 @@ class [[nodiscard]] StaticArray { while (mSize < inRHS.mSize) { - ::new (&mElements[mSize]) T(inRHS[mSize]); + new (&mElements[mSize]) T(inRHS[mSize]); ++mSize; } } @@ -61,7 +61,7 @@ class [[nodiscard]] StaticArray void push_back(const T &inElement) { JPH_ASSERT(mSize < N); - ::new (&mElements[mSize++]) T(inElement); + new (&mElements[mSize++]) T(inElement); } /// Construct element at the back of the array @@ -69,7 +69,7 @@ class [[nodiscard]] StaticArray void emplace_back(A &&... inElement) { JPH_ASSERT(mSize < N); - ::new (&mElements[mSize++]) T(std::forward(inElement)...); + new (&mElements[mSize++]) T(std::forward(inElement)...); } /// Remove element from the back of the array @@ -103,7 +103,7 @@ class [[nodiscard]] StaticArray JPH_ASSERT(inNewSize <= N); if constexpr (!std::is_trivially_constructible()) for (T *element = reinterpret_cast(mElements) + mSize, *element_end = reinterpret_cast(mElements) + inNewSize; element < element_end; ++element) - ::new (element) T; + new (element) T; if constexpr (!std::is_trivially_destructible()) for (T *element = reinterpret_cast(mElements) + inNewSize, *element_end = reinterpret_cast(mElements) + mSize; element < element_end; ++element) element->~T(); @@ -232,7 +232,7 @@ class [[nodiscard]] StaticArray while (mSize < rhs_size) { - ::new (&mElements[mSize]) T(inRHS[mSize]); + new (&mElements[mSize]) T(inRHS[mSize]); ++mSize; } } @@ -253,7 +253,7 @@ class [[nodiscard]] StaticArray while (mSize < rhs_size) { - ::new (&mElements[mSize]) T(inRHS[mSize]); + new (&mElements[mSize]) T(inRHS[mSize]); ++mSize; } } diff --git a/Jolt/Core/UnorderedMap.h b/Jolt/Core/UnorderedMap.h index f876e2849..236eaaa69 100644 --- a/Jolt/Core/UnorderedMap.h +++ b/Jolt/Core/UnorderedMap.h @@ -42,7 +42,7 @@ class UnorderedMap : public HashTable, UnorderedMapDe bool inserted = this->InsertKey(inKey, index); value_type &key_value = this->GetElement(index); if (inserted) - ::new (&key_value) value_type(inKey, Value()); + new (&key_value) value_type(inKey, Value()); return key_value.second; } @@ -52,7 +52,7 @@ class UnorderedMap : public HashTable, UnorderedMapDe size_type index; bool inserted = this->InsertKey(inKey, index); if (inserted) - ::new (&this->GetElement(index)) value_type(std::piecewise_construct, std::forward_as_tuple(inKey), std::forward_as_tuple(std::forward(inArgs)...)); + new (&this->GetElement(index)) value_type(std::piecewise_construct, std::forward_as_tuple(inKey), std::forward_as_tuple(std::forward(inArgs)...)); return std::make_pair(iterator(this, index), inserted); } @@ -62,7 +62,7 @@ class UnorderedMap : public HashTable, UnorderedMapDe size_type index; bool inserted = this->InsertKey(inKey, index); if (inserted) - ::new (&this->GetElement(index)) value_type(std::piecewise_construct, std::forward_as_tuple(std::move(inKey)), std::forward_as_tuple(std::forward(inArgs)...)); + new (&this->GetElement(index)) value_type(std::piecewise_construct, std::forward_as_tuple(std::move(inKey)), std::forward_as_tuple(std::forward(inArgs)...)); return std::make_pair(iterator(this, index), inserted); }