CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
expanding_vector.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9
10#ifndef CPROVER_UTIL_EXPANDING_VECTOR_H
11#define CPROVER_UTIL_EXPANDING_VECTOR_H
12
13#include <vector>
14
15template<typename T>
17{
18 typedef std::vector<T> data_typet;
20
21public:
22 // NOLINTNEXTLINE(readability/identifiers)
23 typedef typename data_typet::size_type size_type;
24 // NOLINTNEXTLINE(readability/identifiers)
25 typedef typename data_typet::iterator iterator;
26 // NOLINTNEXTLINE(readability/identifiers)
27 typedef typename data_typet::const_iterator const_iterator;
28
29 T &operator[] (typename std::vector<T>::size_type n)
30 {
31 if(n>=data.size())
32 data.resize(n+1);
33 return data[n];
34 }
35
36 void clear() { data.clear(); }
37
38 iterator begin() { return data.begin(); }
39 const_iterator begin() const { return data.begin(); }
40 const_iterator cbegin() const { return data.cbegin(); }
41
42 iterator end() { return data.end(); }
43 const_iterator end() const { return data.end(); }
44 const_iterator cend() const { return data.cend(); }
45
46 size_type size() const { return data.size(); }
47
48 void push_back(const T &t) { data.push_back(t); }
49 void push_back(T &&t) { data.push_back(std::move(t)); }
50};
51
52#endif // CPROVER_UTIL_EXPANDING_VECTOR_H
virtual void clear()
Reset the abstract state.
Definition ai.h:265
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
std::vector< T > data_typet
size_type size() const
data_typet::iterator iterator
const_iterator cend() const
data_typet::const_iterator const_iterator
const_iterator begin() const
T & operator[](typename std::vector< T >::size_type n)
const_iterator cbegin() const
void push_back(const T &t)
const_iterator end() const
data_typet::size_type size_type