36 template <
typename DataT,
typename HashT = HashFn<DataT> >
82 m_vector = other.m_vector;
83 m_hash = other.m_hash;
118 return m_vector.
size();
126 return m_vector.
empty();
143 template<
typename T2 >
148 typename HashType::iterator it = m_hash.
find(data);
149 if (it != m_hash.
end())
152 m_vector[it->second] = data;
153 return &m_vector[it->second];
177 template<
typename T2 >
195 template<
typename OldDataT,
typename NewDataT >
200 auto oldIt = m_hash.
find( oldData );
201 if ( oldIt == m_hash.
end() )
204 size_t index = oldIt->second;
205 m_vector[ index ] = newData;
206 m_hash.
erase( oldIt );
207 m_hash.
insert( newData, index );
209 return begin() + index;
220 template<
typename T2 >
236 template<
typename T2 >
241 typename HashType::iterator it = m_hash.
find( key );
242 if (it == m_hash.
end())
245 return &m_vector[it->second];
255 template<
typename T2 >
260 typename HashType::const_iterator it = m_hash.
find( key );
261 if (it == m_hash.
end())
265 return &m_vector[it->second];
276 return m_vector.
begin();
286 return m_vector.
begin();
316 return m_vector.
end();
325 return m_vector.
end();
335 return m_vector.
rend(); }
343 return m_vector.
rend();
370 return m_vector[m_vector.
size()-1];
376 inline const DataT&
back()
const
379 return m_vector[m_vector.
size()-1];
392 template<
typename T2 >
397 typename HashType::iterator it = m_hash.
find( key );
398 if (it == m_hash.
end())
428 typename HashType::iterator hashIt = m_hash.
find( key );
484 inline const DataT&
at(
size_t index)
const
486 return m_vector.
at(index);
495 inline DataT&
at(
size_t index)
497 return m_vector.
at(index);
550 for(; it != m_vector.
end(); ++it)
584 return removeElements.
size();
592 return m_vector.
size() == m_hash.
size();
595 void erase(
typename HashType::iterator it )
597 size_t idx = it->second;
602 if (m_vector.
size() > 1 && idx != (m_vector.
size()-1))
608 m_vector[idx] = lastElement;
614 m_hash.
insert( lastElement, idx );
ClearPolicy
agxData::Values from this enumeration is passed to the subclasses' 'clear' method in order to control...
@ SHRINK_BUFFER
Buffer is deallocated and replaced by an newly allocated empty buffer.
@ MAINTAIN_BUFFER
Buffer is maintained (normal stl behavior).
@ SHRINK_BUFFER_AVERAGED
Buffer is shrunk if a smoothing average (which is updated each clear call) goes below a threshold.
bool contains(const KeyT &k) const
Check if the hash table contains a key/value pair for the given key.
iterator end()
Iterator marking end of hash table.
bool erase(const KeyT &key)
Erase an element from the hash table.
void reserve(size_t num_elems)
Make room for this many elements in the hash table.
insert_iterator insert(const KeyT &key, const ValueT value)
Insert a key/value pair into the hash table.
iterator find(const KeyT &key)
Find a key/value pair in the hash table given a key.
void clear(int=0)
Remove all elements, keeping full capacity.
Inheritance with partial specialization due to bug with ref_ptr containers.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
const VectorType & vector() const
void reserve(size_t size)
Reserve capacity in the hash table.
size_t purge(T purger)
Purge the hash set.
bool contains(const T2 &key) const
Hash search for the data in the container.
VectorType::const_reverse_iterator const_reverse_iterator
const_iterator end() const
iterator find(const T2 &key)
Perform a hash search for a given key.
HashTable< DataT, size_t, HashT > HashType
const_iterator find(const T2 &key) const
Perform a hash search for a given key.
void clear(ClearPolicy policy=SHRINK_BUFFER_AVERAGED)
Remove all elements.
VectorType::reverse_iterator reverse_iterator
const_iterator begin() const
const_reverse_iterator rbegin() const
bool erase(const iterator &it)
Erase an element using an iterator.
reverse_iterator rbegin()
SetVector(const ContainerType &other)
Copy constructor.
DataT & operator[](size_t i)
Access an element in the vector using an index.
iterator push_back(const T2 &data)
Insert a data element in to the end of the container.
ContainerType & operator=(const ContainerType &other)
Assignment operator.
const DataT & operator[](size_t i) const
Access an element in the vector using an index.
const HashType & table() const
bool empty() const
Return true if the container is empty.
const DataT & front() const
DataT & at(size_t index)
Access an element in the vector using an index.
iterator insert(const T2 &data)
Insert a data element in to the end of the container.
size_t size() const
Return the number of inserted elements.
Vector< DataT > VectorType
iterator replace(const OldDataT &oldData, const NewDataT &newData)
Replace data in set vector.
const DataT & at(size_t index) const
Access an element in the vector using an index.
VectorType::const_iterator const_iterator
const DataT & const_reference
bool erase(const T2 &key)
Erase an element from the container.
SetVector< DataT, HashT > ContainerType
VectorType::iterator iterator
const DataT & back() const
const_reverse_iterator rend() const
void clear(ClearPolicy policy=SHRINK_BUFFER_AVERAGED)
Remove all elements, optionally with maintained buffer allocation.
reverse_iterator rbegin()
T & at(size_t index) const
const DataT * const_iterator
void reserve(size_t size)
Reserve capacity in the vector.
void push_back(const T2 &value)
std::reverse_iterator< iterator > reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
The agx namespace contains the dynamics/math part of the AGX Dynamics API.