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

This class represents a simple generic set. More...

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

Classes

class  Iterator
 Class Iterator. More...
 

Public Member Functions

 Set (MemoryAllocator &allocator, uint64 capacity=0)
 Constructor.
 
 Set (const Set< V, Hash, KeyEqual > &set)
 Copy constructor.
 
 ~Set ()
 Destructor.
 
void reserve (uint64 capacity)
 Allocate memory for a given number of elements.
 
bool contains (const V &value) const
 Return true if the set contains a given value.
 
bool add (const V &value)
 Add a value into the set. More...
 
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 V &value)
 Remove the element from the set with a given value This method returns an iterator pointing to the element after the one that has been removed.
 
Array< V > toArray (MemoryAllocator &arrayAllocator) const
 Return an array with all the values of the set.
 
void clear (bool releaseMemory=false)
 Clear the set.
 
uint64 size () const
 Return the number of elements in the set.
 
uint64 capacity () const
 Return the capacity of the set.
 
Iterator find (const V &value) const
 Try to find an item of the set given a key. More...
 
bool operator== (const Set< V > &set) const
 Overloaded equality operator.
 
bool operator!= (const Set< V > &set) const
 Overloaded not equal operator.
 
Set< V > & operator= (const Set< V > &set)
 Overloaded assignment operator.
 
Iterator begin () const
 Return a begin iterator.
 
Iterator end () const
 Return a end iterator.
 

Detailed Description

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

This class represents a simple generic set.

This set is implemented with a hash table.

Member Function Documentation

◆ add()

template<typename V , class Hash = std::hash<V>, class KeyEqual = std::equal_to<V>>
bool reactphysics3d::Set< V, Hash, KeyEqual >::add ( const V &  value)
inline

Add a value into the set.

Returns true if the item has been inserted and false otherwise.

◆ find()

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

Try to find an item of the set 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: