31 #ifndef COMMON_STD_VECTOR_H 32 #define COMMON_STD_VECTOR_H 34 #include "common/array.h" 52 return (*_owner)[_index];
61 return _owner == rhs._owner && _index == rhs._index;
64 return !operator==(rhs);
78 const T operator*()
const {
79 return (*_owner)[_index];
88 return _owner == rhs._owner && _index == rhs._index;
91 return !operator==(rhs);
94 return _index > rhs._index;
108 void insert(
const T &element) {
116 int destIndex = position - this->
begin();
117 for (; first != last; ++first) {
122 T &at(
size_t index) {
123 return (*
this)[index];
125 const T &at(
size_t index)
const {
126 return (*
this)[index];
132 void remove(T element) {
133 for (uint i = 0; i < this->
size(); ++i) {
134 if (this->
operator[](i) == element) {
146 if (it != this->
end()) {
147 size_t count = it - this->
begin();
148 for (
size_t ctr = 0; ctr < count; ++ctr) {
156 return this->
begin();
161 reverse_iterator rbegin() {
162 return reverse_iterator(
this, (
int)this->
size() - 1);
164 reverse_iterator rend() {
165 return reverse_iterator(
this, -1);
167 const_reverse_iterator rbegin()
const {
168 return const_reverse_iterator(
this, (
int)this->
size() - 1);
170 const_reverse_iterator rend()
const {
171 return const_reverse_iterator(
this, -1);
173 const_reverse_iterator crbegin()
const {
174 return const_reverse_iterator(
this, (
int)this->
size() - 1);
176 const_reverse_iterator crend()
const {
177 return const_reverse_iterator(
this, -1);
void rotate(iterator it)
Definition: vector.h:145
void insert_at(size_type idx, const T &element)
Definition: array.h:241
void insert(iterator position, const_iterator first, const_iterator last)
Definition: vector.h:115
iterator end()
Definition: array.h:379
iterator begin()
Definition: array.h:374
T * iterator
Definition: array.h:54
T & front()
Definition: array.h:217
void push_back(const T &element)
Definition: array.h:180
const T * const_iterator
Definition: array.h:55
size_type size() const
Definition: array.h:315
T remove_at(size_type idx)
Definition: array.h:260
Definition: algorithm.h:37