12#ifndef CPROVER_UTIL_DENSE_INTEGER_MAP_H
13#define CPROVER_UTIL_DENSE_INTEGER_MAP_H
19#include <unordered_set>
29 return std::forward<T>(t);
53template <
class K,
class V,
class KeyToDenseInteger =
identity_functort>
118 template <
class UnderlyingIterator,
class UnderlyingValue>
144 typename backing_storet::const_iterator,
145 const typename backing_storet::value_type>()
const
190 (
typename backing_storet::const_iterator)it);
209 typename backing_storet::iterator,
210 typename backing_storet::value_type>
216 typename backing_storet::const_iterator,
217 const typename backing_storet::value_type>
231 template <
typename Iter>
236 "setup_for_keys must only be called on a newly-constructed container");
241 for(
Iter it = first; it != last; ++it)
248 "keys for use in dense_integer_mapt must be unique");
260 "dense_integer_mapt size should fit in std::size_t");
262 map_size <= std::numeric_limits<std::size_t>::max(),
263 "dense_integer_mapt size should fit in std::size_t");
266 for(
Iter it = first; it != last; ++it)
278 return map.at(index).second;
284 return map.at(index).second;
291 return map.at(index).second;
294 std::pair<iterator, bool>
insert(
const std::pair<const K, V> &
pair)
298 static_cast<typename backing_storet::iterator::difference_type
>(index);
306 map.at(index).second =
pair.second;
294 std::pair<iterator, bool>
insert(
const std::pair<const K, V> &
pair) {
…}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
std::forward_iterator_tag iterator_category
reference operator*() const
UnderlyingIterator underlying_iterator
self_typet operator++(int junk)
iterator_templatet< UnderlyingIterator, UnderlyingValue > self_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)
pointer operator->() const
UnderlyingIterator advance(UnderlyingIterator it)
std::ptrdiff_t difference_type
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'.