Skip to content

Commit 7ffbab7

Browse files
committed
fix: optimize access to components in ComponentArray by using data() method to ignore range checking
1 parent 9b37d06 commit 7ffbab7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/Freyr/Containers/ComponentArray.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace FREYR_NAMESPACE
4747

4848
ComponentId GetComponentId() override { return fr::GetComponentId<T>(); }
4949

50-
T& operator[](size_t index) { return mComponents[index]; }
50+
T& operator[](size_t index) { return mComponents.data()[index]; }
5151

5252
void Resize(size_t size) override { mComponents.resize(size); }
5353

@@ -62,7 +62,7 @@ namespace FREYR_NAMESPACE
6262
{
6363
FREYR_ASSERT(index < mComponents.size() && "Accessing non-existent component.");
6464

65-
return mComponents[index];
65+
return mComponents.data()[index];
6666
}
6767

6868
void CopyComponent(const size_t from, const size_t to, IComponentArray* componentArray) override

0 commit comments

Comments
 (0)