ReactPhysics3D  v0.10.1
C++ Physics engine library
reactphysics3d::Map< K, V, Hash, KeyEqual > Class Template Reference

This class represents a simple generic associative map. More...

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

Classes

class  Iterator
 Class Iterator. More...
 

Public Member Functions

 Map (MemoryAllocator &allocator, uint64 capacity=0)
 Constructor.
 
 Map (const Map< K, V > &map)
 Copy constructor.
 
 ~Map ()
 Destructor.
 
void reserve (uint64 capacity)
 Allocate memory for a given number of elements.
 
bool containsKey (const K &key) const
 Return true if the map contains an item with the given key.
 
bool add (const Pair< K, V > &keyValue, bool insertIfAlreadyPresent=false)
 Add an element into the map Returns true if the item has been inserted and false otherwise.
 
Iterator remove (const Iterator &it)
 Remove the element pointed by some iterator This method returns an iterator pointing to the element after the one that has been removed.
 
Iterator remove (const K &key)
 Remove the element from the map with a given key This method returns an iterator pointing to the element after the one that has been removed.
 
void clear (bool releaseMemory=false)
 Clear the map.
 
uint64 size () const
 Return the number of elements in the map.
 
uint64 capacity () const
 Return the capacity of the map.
 
Iterator find (const K &key) const
 Try to find an item of the map given a key. More...
 
V & operator[] (const K &key)
 Overloaded index operator.
 
const V & operator[] (const K &key) const
 Overloaded index operator.
 
bool operator== (const Map< K, V > &map) const
 Overloaded equality operator.
 
bool operator!= (const Map< K, V > &map) const
 Overloaded not equal operator.
 
Map< K, V > & operator= (const Map< K, V > &map)
 Overloaded assignment operator.
 
Iterator begin () const
 Return a begin iterator.
 
Iterator end () const
 Return a end iterator.
 

Detailed Description

template<typename K, typename V, class Hash = std::hash<K>, class KeyEqual = std::equal_to<K>>
class reactphysics3d::Map< K, V, Hash, KeyEqual >

This class represents a simple generic associative map.

This map is implemented with a hash table.

Member Function Documentation

◆ find()

template<typename K , typename V , class Hash = std::hash<K>, class KeyEqual = std::equal_to<K>>
Iterator reactphysics3d::Map< K, V, Hash, KeyEqual >::find ( const K &  key) const
inline

Try to find an item of the map given a key.

The method returns an iterator to the found item or an iterator pointing to the end if not found


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