Browse Source

Added StaticArray::at function for JoltPhysics.js

Jorrit Rouwe 1 year ago
parent
commit
caf681426d
1 changed files with 13 additions and 0 deletions
  1. 13 0
      Jolt/Core/StaticArray.h

+ 13 - 0
Jolt/Core/StaticArray.h

@@ -156,6 +156,19 @@ public:
 		return reinterpret_cast<const T &>(mElements[inIdx]);
 	}
 
+	/// Access element
+	T &					at(size_type inIdx)
+	{
+		JPH_ASSERT(inIdx < mSize);
+		return reinterpret_cast<T &>(mElements[inIdx]);
+	}
+
+	const T &			at(size_type inIdx) const
+	{
+		JPH_ASSERT(inIdx < mSize);
+		return reinterpret_cast<const T &>(mElements[inIdx]);
+	}
+
 	/// First element in the array
 	const T &			front() const
 	{