Include file:
#include "mcrl2/utilities/indexed_set.h
mcrl2::utilities::
indexed_set
¶A set that assigns each element an unique index.
mcrl2::utilities::indexed_set::
const_iterator
¶typedef for std::deque< Key >::const_iterator
mcrl2::utilities::indexed_set::
const_pointer
¶typedef for const value_type *
mcrl2::utilities::indexed_set::
const_reference
¶typedef for const value_type &
mcrl2::utilities::indexed_set::
const_reverse_iterator
¶typedef for std::deque< Key >::const_reverse_iterator
mcrl2::utilities::indexed_set::
difference_type
¶typedef for std::ptrdiff_t
mcrl2::utilities::indexed_set::
hasher
¶typedef for Hash
mcrl2::utilities::indexed_set::
iterator
¶typedef for std::deque< Key >::iterator
mcrl2::utilities::indexed_set::
key_equal
¶typedef for Equals
mcrl2::utilities::indexed_set::
key_type
¶typedef for Key
mcrl2::utilities::indexed_set::
pointer
¶typedef for value_type *
mcrl2::utilities::indexed_set::
reference
¶typedef for value_type &
mcrl2::utilities::indexed_set::
reverse_iterator
¶typedef for std::deque< Key >::reverse_iterator
mcrl2::utilities::indexed_set::
size_type
¶typedef for std::size_t
mcrl2::utilities::indexed_set::
value_type
¶typedef for std::pair< const key_type, size_type >
mcrl2::utilities::indexed_set::
m_equals
¶mcrl2::utilities::indexed_set::
m_hasher
¶mcrl2::utilities::indexed_set::
m_hashtable
¶mcrl2::utilities::indexed_set::
m_keys
¶mcrl2::utilities::indexed_set::
npos
¶Value returned when an element does not exist in the set.
Returns: Value indicating non existing element, equal to std::numeric_limits<std::size_t>::max().
put_in_hashtable
(const Key &key, std::size_t n)¶Inserts the given (key, n) pair into the indexed set.
resize_hashtable
()¶Resizes the hash table to twice its current size.
at
(const size_type index) const¶Returns a reference to the mapped value.
Returns an out_of_range exception if there is no element with the given key.
Parameters:
index The position in the indexed set.
Returns: The value at position index.
begin
()Forward iterator which runs through the elements from the lowest to the largest number.
Complexity is constant per operation.
begin
() constForward iterator which runs through the elements from the lowest to the largest number.
Complexity is constant per operation.
cbegin
() const¶const_iterator going through the elements in the set numbered from zero upwards.
cend
() const¶End of the forward const_iterator.
clear
()Clears the indexed set by removing all its elements. It is not guaranteed that the memory is released too.
crbegin
() const¶Reverse const_iterator going through the elements from the highest to the lowest numbered element.
crend
() const¶End of the reverse const_iterator.
end
()End of the forward iterator.
end
() constEnd of the forward iterator.
find
(const key_type &key) const¶Provides an iterator to the stored key in the indexed set.
Parameters:
key The key that is sought.
Returns: An iterator to the key, otherwise end().
index
(const key_type &key) const¶Returns a reference to the mapped value.
Returns an invalid value, larger or equal than the size of the indexed set, if there is no element with the given key.
indexed_set
()Constructor of an empty indexed set. Starts with a hashtable of size 128.
indexed_set
(std::size_t initial_hashtable_size, const hasher &hash = hasher(), const key_equal &equals = key_equal())¶Constructor of an empty index set. Starts with a hashtable of the indicated size.
Parameters:
initial_hashtable_size The initial size of the hashtable.
hash The hash function.
equals The comparison function for its elements.
insert
(const key_type &key)¶Insert a key in the indexed set and return its index.
If the element was already in the set, the resulting bool is true, and the existing index is returned. Otherwise, the key is inserted in the set, and the next available index is assigned to it.
Parameters:
key The key to be inserted in the set.
Returns: The index of the key and a boolean indicating whether the element was actually inserted.
operator[]
(const size_type index) constOperator that provides a const reference at the position indicated by index.
Parameters:
index The position in the indexed set.
Returns: The value at position index.
rbegin
()¶Reverse iterator going through the elements in the set from the largest to the smallest index.
size
() constThe number of elements in the indexed set.
Returns: The number of elements in the indexed set.