ReactPhysics3D  v0.10.2
C++ Physics engine library
Loading...
Searching...
No Matches
reactphysics3d::Array< T > Class Template Reference

This class represents a simple dynamic array with custom memory allocator. More...

#include <include/reactphysics3d/containers/Array.h>

Classes

class  Iterator
 Class Iterator. More...
 

Public Member Functions

 Array (MemoryAllocator &allocator, uint64 capacity=0)
 Constructor.
 
 Array (const Array< T > &array)
 Copy constructor.
 
 ~Array ()
 Destructor.
 
void reserve (uint64 capacity)
 Allocate memory for a given number of elements.
 
void add (const T &element)
 Add an element into the array.
 
template<typename... Ts>
void emplace (Ts &&... args)
 Add an element into the array by constructing it directly into the array (in order to avoid a copy)
 
void addWithoutInit (uint64 nbElements)
 Add a given numbers of elements at the end of the array but do not init them.
 
Iterator find (const T &element)
 Try to find a given item of the array and return an iterator pointing to that element if it exists in the array.
 
Iterator remove (const T &element)
 Look for an element in the array and remove it.
 
Iterator remove (const Iterator &it)
 Remove an element from the array and return a iterator pointing to the element after the removed one (or end() if none)
 
Iterator removeAt (uint64 index)
 Remove an element from the array at a given index (all the following items will be moved)
 
void removeAtAndReplaceByLast (uint64 index)
 Remove an element from the list at a given index and replace it by the last one of the list (if any)
 
void addRange (const Array< T > &array, uint64 startIndex=0)
 Remove an element from the array at a given index and replace it by the last one of the array (if any) Append another array at the end of the current one.
 
void clear (bool releaseMemory=false)
 Clear the array.
 
uint64 size () const
 Return the number of elements in the array.
 
uint64 capacity () const
 Return the capacity of the array.
 
T & operator[] (const uint64 index)
 Overloaded index operator.
 
const T & operator[] (const uint64 index) const
 Overloaded const index operator.
 
bool operator== (const Array< T > &array) const
 Overloaded equality operator.
 
bool operator!= (const Array< T > &array) const
 Overloaded not equal operator.
 
Array< T > & operator= (const Array< T > &array)
 Overloaded assignment operator.
 
Iterator begin () const
 Return a begin iterator.
 
Iterator end () const
 Return a end iterator.
 

Detailed Description

template<typename T>
class reactphysics3d::Array< T >

This class represents a simple dynamic array with custom memory allocator.

Member Function Documentation

◆ find()

template<typename T >
Iterator reactphysics3d::Array< T >::find ( const T &  element)
inline

Try to find a given item of the array and return an iterator pointing to that element if it exists in the array.

Otherwise, this method returns the end() iterator


The documentation for this class was generated from the following files: