Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confused about the constructor in the Array container #405

Open
lokitkhemka opened this issue Oct 21, 2024 · 0 comments
Open

Confused about the constructor in the Array container #405

lokitkhemka opened this issue Oct 21, 2024 · 0 comments

Comments

@lokitkhemka
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant