reactphysics3d icon indicating copy to clipboard operation
reactphysics3d copied to clipboard

Confused about the constructor in the `Array` container

Open lokitkhemka opened this issue 1 year ago • 0 comments

Hi,

I was reading through the code of reactphysics3d, when I came across the following constructor:

Array(MemoryAllocator& allocator, uint64 capacity = 0)
            : mBuffer(nullptr), mSize(0), mCapacity(0), mAllocator(allocator)

Why is mCapacity being initialized to 0 and not capacity? I tried changing to following:

Array(MemoryAllocator& allocator, uint64 capacity = 0)
            : mBuffer(nullptr), mSize(0), mCapacity(capacity), mAllocator(allocator)

I get the access violation error thrown when running the tests. I am sorry if this is not the forum for asking such minor questions, but it is bothering me a lot. When the array is constructed without any capacity, shouldn't they be technically the same?

Thank you.

lokitkhemka avatar Oct 21 '24 06:10 lokitkhemka