Go to the documentation of this file.00001
00007 #ifndef INT_VECTOR_HH
00008 #define INT_VECTOR_HH
00009
00018 namespace my_lib {
00019
00025 class int_vector_t {
00026 private:
00027 int * _content;
00028 unsigned _size;
00029 unsigned _capacity;
00030 public:
00037 int_vector_t (unsigned size);
00043 ~int_vector_t ();
00044
00053 inline
00054 int& operator[] (unsigned i) {
00055 return _content[i];
00056 }
00068 inline
00069 const int& operator[] (unsigned i) cont {
00070 return _content[i];
00071 }
00072
00080 inline
00081 unsigned size() const {
00082 return _size;
00083 }
00084
00096 inline
00097 unsigned capacity() const {
00098 return _capacity;
00099 }
00100
00108 void resize(unsigned new_size);
00117 void reserve(unsigned new_capacity);
00118
00119
00125 typedef int* iterator;
00133 typedef const int* const_iterator;
00134
00141 inline
00142 iterator begin() {
00143 return _content;
00144 }
00145
00152 inline
00153 const_iterator begin() const {
00154 return _content;
00155 }
00156
00163 inline
00164 iterator end() {
00165 return _content+_size;
00166 }
00167
00174 inline
00175 const_iterator end() const {
00176 return _content+_size;
00177 }
00178 };
00179
00180 }
00181
00182
00183 #endif //INT_VECTOR_HH