53 typename KEY,
typename VALUE,
54 typename VECTOR_T =
typename std::vector<std::pair<KEY, VALUE>>>
102 return (i <
m_vec.size()) ? 1 : 0;
119 return m_vec[i].second;
127 this->
operator[](keyvalpair.first) = keyvalpair;
132 this->
operator[](keyvalpair.first) = keyvalpair;
140 if (i <
m_vec.size())
141 return m_vec.begin() + i;
150 if (i <
m_vec.size())
151 return m_vec.begin() + i;
const vec_t & getVector() const
Return a read-only reference to the internal vector.
typename vec_t::size_type size_type
map_as_vector()=default
< Default constructor - does nothing */
void insert(const iterator &guess_point, const value_type &keyvalpair)
Insert pair<key,val>, as in std::map (guess_point is actually ignored in this class) ...
VALUE & operator[](const size_t i)
Write/read via [i] operator, that creates all elements up to (and including) the i'th if they didn't ...
typename vec_t::const_iterator const_iterator
std::pair< size_t, size_t > value_type
iterator find(const size_t i)
Constant-time find, returning an iterator to the <key,val> pair or to end() if not found (that is...
map_as_vector(const map_as_vector< KEY, VALUE > &o)
Copy constructor.
const_iterator find(const size_t i) const
Constant-time find, returning an iterator to the <key,val> pair or to end() if not found (that is...
const_reverse_iterator rbegin() const
const_reverse_iterator rend() const
void insert(const value_type &keyvalpair)
Insert pair<key,val>, as in std::map.
A STL-like container which looks and behaves (almost exactly) like a std::map<> but is implemented as...
std::reverse_iterator< iterator > reverse_iterator
typename std::vector< std::pair< size_t, size_t >> vec_t
size_type max_size() const
Maximum size due to system limits.
void clear()
Clear the contents of this container.
size_type count(const key_type i) const
Count how many entries have a given key value - unlike std::map<K,V>, recall that this class will say...
std::reverse_iterator< const_iterator > const_reverse_iterator
const_iterator end() const
reverse_iterator rbegin()
const_iterator begin() const
void swap(map_as_vector< KEY, VALUE > &o)
Efficient swap with another object.
typename vec_t::iterator iterator
vec_t m_vec
The actual container.