MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / clear

Method clear

include/reactphysics3d/containers/Array.h:407–425  ·  view source on GitHub ↗

Clear the array

Source from the content-addressed store, hash-verified

405
406 /// Clear the array
407 void clear(bool releaseMemory = false) {
408
409 // Call the destructor of each element
410 for (uint64 i=0; i < mSize; i++) {
411 mBuffer[i].~T();
412 }
413
414 mSize = 0;
415
416 // If we need to release all the allocated memory
417 if (releaseMemory && mCapacity > 0) {
418
419 // Release the memory allocated on the heap
420 mAllocator.release(mBuffer, mCapacity * sizeof(T));
421
422 mBuffer = nullptr;
423 mCapacity = 0;
424 }
425 }
426
427 /// Return the number of elements in the array
428 uint64 size() const {

Callers

nothing calls this directly

Calls 1

releaseMethod · 0.45

Tested by

no test coverage detected