diff --git a/Source/Engine/Core/Collections/Array.h b/Source/Engine/Core/Collections/Array.h index e096992f8..3006d045e 100644 --- a/Source/Engine/Core/Collections/Array.h +++ b/Source/Engine/Core/Collections/Array.h @@ -25,7 +25,7 @@ private: int32 _capacity; AllocationData _allocation; - FORCE_INLINE static void MoveToEmpty(AllocationData& to, AllocationData& from, int32 fromCount, int32 fromCapacity) + FORCE_INLINE static void MoveToEmpty(AllocationData& to, AllocationData& from, const int32 fromCount, const int32 fromCapacity) { if IF_CONSTEXPR (AllocationType::HasSwap) to.Swap(from); @@ -52,7 +52,7 @@ public: /// Initializes a new instance of the class. /// /// The initial capacity. - explicit Array(int32 capacity) + explicit Array(const int32 capacity) : _count(0) , _capacity(capacity) { @@ -79,7 +79,7 @@ public: /// /// The initial data. /// The amount of items. - Array(const T* data, int32 length) + Array(const T* data, const int32 length) { ASSERT(length >= 0); _count = _capacity = length; @@ -255,7 +255,7 @@ public: /// /// The index. /// true if is valid a index; otherwise, false. - bool IsValidIndex(int32 index) const + bool IsValidIndex(const int32 index) const { return index < _count && index >= 0; } @@ -280,7 +280,7 @@ public: /// Gets item at the given index. /// /// The reference to the item. - FORCE_INLINE T& At(int32 index) + FORCE_INLINE T& At(const int32 index) { ASSERT(index >= 0 && index < _count); return _allocation.Get()[index]; @@ -290,7 +290,7 @@ public: /// Gets item at the given index. /// /// The reference to the item. - FORCE_INLINE const T& At(int32 index) const + FORCE_INLINE const T& At(const int32 index) const { ASSERT(index >= 0 && index < _count); return _allocation.Get()[index]; @@ -300,7 +300,7 @@ public: /// Gets or sets the item at the given index. /// /// The reference to the item. - FORCE_INLINE T& operator[](int32 index) + FORCE_INLINE T& operator[](const int32 index) { ASSERT(index >= 0 && index < _count); return _allocation.Get()[index]; @@ -310,7 +310,7 @@ public: /// Gets the item at the given index. /// /// The reference to the item. - FORCE_INLINE const T& operator[](int32 index) const + FORCE_INLINE const T& operator[](const int32 index) const { ASSERT(index >= 0 && index < _count); return _allocation.Get()[index]; @@ -406,7 +406,7 @@ public: /// /// The new capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void SetCapacity(const int32 capacity, bool preserveContents = true) + void SetCapacity(const int32 capacity, const bool preserveContents = true) { if (capacity == _capacity) return; @@ -422,7 +422,7 @@ public: /// /// The new collection size. /// True if preserve collection data when changing its size, otherwise collection after resize might not contain the previous data. - void Resize(int32 size, bool preserveContents = true) + void Resize(const int32 size, const bool preserveContents = true) { if (_count > size) { @@ -441,7 +441,7 @@ public: /// /// The minimum capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void EnsureCapacity(int32 minCapacity, bool preserveContents = true) + void EnsureCapacity(const int32 minCapacity, const bool preserveContents = true) { if (_capacity < minCapacity) { @@ -466,7 +466,7 @@ public: /// /// The data. /// The amount of items. - void Set(const T* data, int32 count) + void Set(const T* data, const int32 count) { EnsureCapacity(count, false); Memory::DestructItems(_allocation.Get(), _count); @@ -501,7 +501,7 @@ public: /// /// The items to add. /// The items count. - void Add(const T* items, int32 count) + void Add(const T* items, const int32 count) { EnsureCapacity(_count + count); Memory::ConstructItems(_allocation.Get() + _count, items, count); @@ -532,7 +532,7 @@ public: /// Adds the given amount of items to the collection. /// /// The items count. - FORCE_INLINE void AddDefault(int32 count = 1) + FORCE_INLINE void AddDefault(const int32 count = 1) { EnsureCapacity(_count + count); Memory::ConstructItems(_allocation.Get() + _count, count); @@ -543,7 +543,7 @@ public: /// Adds the given amount of uninitialized items to the collection without calling the constructor. /// /// The items count. - FORCE_INLINE void AddUninitialized(int32 count = 1) + FORCE_INLINE void AddUninitialized(const int32 count = 1) { EnsureCapacity(_count + count); _count += count; @@ -568,7 +568,7 @@ public: /// Warning! AddZeroed() will create items without calling the constructor and this is not appropriate for item types that require a constructor to function properly. /// /// The number of new items to add. - void AddZeroed(int32 count = 1) + void AddZeroed(const int32 count = 1) { EnsureCapacity(_count + count); Platform::MemoryClear(_allocation.Get() + _count, count * sizeof(T)); @@ -580,7 +580,7 @@ public: /// /// The zero-based index at which item should be inserted. /// The item to be inserted by copying. - void Insert(int32 index, const T& item) + void Insert(const int32 index, const T& item) { ASSERT(index >= 0 && index <= _count); EnsureCapacity(_count + 1); @@ -597,7 +597,7 @@ public: /// /// The zero-based index at which item should be inserted. /// The item to inserted by moving. - void Insert(int32 index, T&& item) + void Insert(const int32 index, T&& item) { ASSERT(index >= 0 && index <= _count); EnsureCapacity(_count + 1); @@ -613,7 +613,7 @@ public: /// Insert the given item at specified index with keeping items order. /// /// The zero-based index at which item should be inserted. - void Insert(int32 index) + void Insert(const int32 index) { ASSERT(index >= 0 && index <= _count); EnsureCapacity(_count + 1); @@ -954,7 +954,7 @@ public: { } - Iterator(Array const* array, const int32 index) + Iterator(const Array* array, const int32 index) : _array(const_cast(array)) , _index(index) { @@ -1084,7 +1084,7 @@ public: }; template -void* operator new(size_t size, Array& array) +void* operator new(const size_t size, Array& array) { ASSERT(size == sizeof(T)); const int32 index = array.Count(); @@ -1093,7 +1093,7 @@ void* operator new(size_t size, Array& array) } template -void* operator new(size_t size, Array& array, int32 index) +void* operator new(const size_t size, Array& array, const int32 index) { ASSERT(size == sizeof(T)); array.Insert(index); diff --git a/Source/Engine/Core/Collections/BitArray.h b/Source/Engine/Core/Collections/BitArray.h index 70d51bac0..bc101f4ae 100644 --- a/Source/Engine/Core/Collections/BitArray.h +++ b/Source/Engine/Core/Collections/BitArray.h @@ -278,7 +278,7 @@ public: /// /// The minimum capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void EnsureCapacity(int32 minCapacity, const bool preserveContents = true) + void EnsureCapacity(const int32 minCapacity, const bool preserveContents = true) { if (_capacity < minCapacity) { diff --git a/Source/Engine/Core/Collections/Dictionary.h b/Source/Engine/Core/Collections/Dictionary.h index 32f61a30c..2b1bb8916 100644 --- a/Source/Engine/Core/Collections/Dictionary.h +++ b/Source/Engine/Core/Collections/Dictionary.h @@ -110,7 +110,7 @@ private: int32 _size = 0; AllocationData _allocation; - FORCE_INLINE static void MoveToEmpty(AllocationData& to, AllocationData& from, int32 fromSize) + FORCE_INLINE static void MoveToEmpty(AllocationData& to, AllocationData& from, const int32 fromSize) { if IF_CONSTEXPR (AllocationType::HasSwap) to.Swap(from); diff --git a/Source/Engine/Core/Collections/HashSet.h b/Source/Engine/Core/Collections/HashSet.h index a5bf8ae3e..1974051e5 100644 --- a/Source/Engine/Core/Collections/HashSet.h +++ b/Source/Engine/Core/Collections/HashSet.h @@ -93,7 +93,7 @@ private: int32 _size = 0; AllocationData _allocation; - FORCE_INLINE static void MoveToEmpty(AllocationData& to, AllocationData& from, int32 fromSize) + FORCE_INLINE static void MoveToEmpty(AllocationData& to, AllocationData& from, const int32 fromSize) { if IF_CONSTEXPR (AllocationType::HasSwap) to.Swap(from); @@ -252,7 +252,7 @@ public: { } - Iterator(HashSet const* collection, const int32 index) + Iterator(const HashSet* collection, const int32 index) : _collection(const_cast(collection)) , _index(index) { @@ -307,7 +307,7 @@ public: return _index >= 0 && _index < _collection->_size; } - FORCE_INLINE bool operator !() const + FORCE_INLINE bool operator!() const { return !(bool)*this; } @@ -474,7 +474,7 @@ public: /// /// The minimum required capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void EnsureCapacity(int32 minCapacity, const bool preserveContents = true) + void EnsureCapacity(const int32 minCapacity, const bool preserveContents = true) { if (_size >= minCapacity) return; diff --git a/Source/Engine/Renderer/RenderListBuffer.h b/Source/Engine/Renderer/RenderListBuffer.h index 50f6ed519..e6a22949a 100644 --- a/Source/Engine/Renderer/RenderListBuffer.h +++ b/Source/Engine/Renderer/RenderListBuffer.h @@ -42,7 +42,7 @@ public: /// Initializes a new instance of the class. /// /// The initial capacity. - explicit RenderListBuffer(int32 capacity) + explicit RenderListBuffer(const int32 capacity) : _count(0) , _capacity(capacity) { @@ -55,7 +55,7 @@ public: /// /// The initial data. /// The amount of items. - RenderListBuffer(const T* data, int32 length) + RenderListBuffer(const T* data, const int32 length) { ASSERT(length >= 0); _count = _capacity = length; @@ -188,7 +188,7 @@ public: /// Gets or sets the item at the given index. /// /// The reference to the item. - FORCE_INLINE T& operator[](int32 index) + FORCE_INLINE T& operator[](const int32 index) { ASSERT(index >= 0 && index < Count()); return _allocation.Get()[index]; @@ -198,7 +198,7 @@ public: /// Gets the item at the given index. /// /// The reference to the item. - FORCE_INLINE const T& operator[](int32 index) const + FORCE_INLINE const T& operator[](const int32 index) const { ASSERT(index >= 0 && index < Count()); return _allocation.Get()[index]; @@ -260,7 +260,7 @@ public: /// /// The new collection size. /// True if preserve collection data when changing its size, otherwise collection after resize might not contain the previous data. - void Resize(int32 size, bool preserveContents = true) + void Resize(const int32 size, const bool preserveContents = true) { _locker.Lock(); if (_count > size) @@ -280,7 +280,7 @@ public: /// Ensures the collection has given capacity (or more). /// /// The minimum capacity. - void EnsureCapacity(int32 minCapacity) + void EnsureCapacity(const int32 minCapacity) { _locker.Lock(); int32 capacity = static_cast(Platform::AtomicRead(&_capacity));