ReactPhysics3D  v0.10.1
C++ Physics engine library
reactphysics3d::Deque< T > Class Template Reference

This class represents a Deque. More...

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

Classes

class  Iterator
 Class Iterator. More...
 

Public Member Functions

 Deque (MemoryAllocator &allocator)
 Constructor.
 
 Deque (const Deque< T > &deque)
 Copy constructor.
 
 ~Deque ()
 Destructor.
 
void addBack (const T &element)
 Add an element at the end of the deque.
 
void addFront (const T &element)
 Add an element at the front of the deque.
 
void popFront ()
 Remove the first element of the deque.
 
void popBack ()
 Remove the last element of the deque.
 
const T & getFront () const
 Return a reference to the first item of the deque.
 
const T & getBack () const
 Return a reference to the last item of the deque.
 
void clear ()
 Clear the elements of the deque.
 
uint64 size () const
 Return the number of elements in the deque.
 
T & operator[] (const uint64 index)
 Overloaded index operator.
 
const T & operator[] (const uint64 index) const
 Overloaded const index operator.
 
bool operator== (const Deque< T > &deque) const
 Overloaded equality operator.
 
bool operator!= (const Deque< T > &deque) const
 Overloaded not equal operator.
 
Deque< T > & operator= (const Deque< T > &deque)
 Overloaded assignment operator.
 
Iterator begin () const
 Return a begin iterator.
 
Iterator end () const
 Return a end iterator.
 

Detailed Description

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

This class represents a Deque.

A Deque is a double ended queue. It is possible to push and pop items at both ends of the queue. Note that in the following code, the virtualIndex is the index of the items in the deque in range [0, mSize-1] where 0 is always the front item and mSize-1 the back item. There is a virtual index for each item that is in the deque. The allocatedIndex is the index of a allocated slot in the deque in range [0, (mNbChunks * CHUNK_NB_ITEMS)-1]. A given allocatedIndex corresponds to a slot in the deque that can be empty or contains an item.


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