12#ifndef CPROVER_UTIL_DENSE_INTEGER_MAP_H
13#define CPROVER_UTIL_DENSE_INTEGER_MAP_H
16#include <unordered_set>
29 return std::forward<T>(t);
52template <
class K,
class V,
class KeyToDenseInteger =
identity_functort>
117 template <
class UnderlyingIterator,
class UnderlyingValue>
119 :
public std::iterator<std::forward_iterator_tag, UnderlyingValue>
122 typedef std::iterator<std::forward_iterator_tag, UnderlyingValue>
139 typename backing_storet::const_iterator,
140 const typename backing_storet::value_type>()
const
185 (
typename backing_storet::const_iterator)it);
204 typename backing_storet::iterator,
205 typename backing_storet::value_type>
211 typename backing_storet::const_iterator,
212 const typename backing_storet::value_type>
226 template <
typename Iter>
231 "setup_for_keys must only be called on a newly-constructed container");
236 for(
Iter it = first; it !=
last; ++it)
243 "keys for use in dense_integer_mapt must be unique");
255 "dense_integer_mapt size should fit in std::size_t");
257 map_size <= std::numeric_limits<std::size_t>::max(),
258 "dense_integer_mapt size should fit in std::size_t");
261 for(
Iter it = first; it !=
last; ++it)
273 return map.at(index).second;
279 return map.at(index).second;
286 return map.at(index).second;
289 std::pair<iterator, bool>
insert(
const std::pair<const K, V> &pair)
293 static_cast<typename backing_storet::iterator::difference_type
>(index);
301 map.at(index).second = pair.second;
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
UnderlyingIterator underlying_iterator
base_typet::reference operator*() const
base_typet::pointer operator->() const
self_typet operator++(int junk)
iterator_templatet< UnderlyingIterator, UnderlyingValue > self_typet
std::iterator< std::forward_iterator_tag, UnderlyingValue > base_typet
iterator_templatet(UnderlyingIterator it, const map_typet &underlying_map)
bool operator==(const self_typet &rhs) const
bool operator!=(const self_typet &rhs) const
dense_integer_mapt< K, V, KeyToDenseInteger > map_typet
const map_typet & underlying_map
UnderlyingIterator skip_unset_values(UnderlyingIterator it)
UnderlyingIterator advance(UnderlyingIterator it)
A map type that is backed by a vector, which relies on the ability to (a) see the keys that might be ...
std::pair< iterator, bool > insert(const std::pair< const K, V > &pair)
void setup_for_keys(Iter first, Iter last)
Set the keys that are allowed to be used in this container.
const_iterator cbegin() const
void mark_index_set(std::size_t index)
std::vector< K > possible_keyst
Type of the container returned by possible_keys.
iterator_templatet< typename backing_storet::const_iterator, const typename backing_storet::value_type > const_iterator
const iterator.
possible_keyst possible_keys_vector
std::size_t count(const K &key) const
iterator_templatet< typename backing_storet::iterator, typename backing_storet::value_type > iterator
iterator.
const possible_keyst & possible_keys() const
V & operator[](const K &key)
bool index_is_set(std::size_t index) const
const V & at(const K &key) const
const_iterator cend() const
std::size_t key_to_index(const K &key) const
std::vector< std::pair< K, V > > backing_storet
const_iterator end() const
const_iterator begin() const
std::vector< bool > value_set
Identity functor. When we use C++20 this can be replaced with std::identity.
constexpr T && operator()(T &&t) const
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.