mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-16 14:57:01 +00:00
@@ -38,15 +38,22 @@ public:
|
||||
return *this;
|
||||
}
|
||||
const_pointer_iterator operator+(int v) const {
|
||||
return const_pointer_iterator(this->current + v);
|
||||
const_pointer_iterator it = *this;
|
||||
return it += v;
|
||||
}
|
||||
const_pointer_iterator operator-(int v) const {
|
||||
return const_pointer_iterator(this->current - v);
|
||||
const_pointer_iterator it = *this;
|
||||
return it -= v;
|
||||
}
|
||||
int operator-(const const_pointer_iterator& other) const { return this->current - other.current; }
|
||||
const T& operator*() const { return *current; }
|
||||
const T* operator->() const { return current; }
|
||||
bool operator==(const const_pointer_iterator& other) { return current == other.current; }
|
||||
bool operator!=(const const_pointer_iterator& other) { return current != other.current; }
|
||||
bool operator<(const const_pointer_iterator& other) { return current < other.current; }
|
||||
bool operator>(const const_pointer_iterator& other) { return current > other.current; }
|
||||
bool operator<=(const const_pointer_iterator& other) { return current <= other.current; }
|
||||
bool operator>=(const const_pointer_iterator& other) { return current >= other.current; }
|
||||
|
||||
// friend const_pointer_iterator operator+(const const_pointer_iterator& x, int v) {
|
||||
// return const_pointer_iterator(x.current + v);
|
||||
@@ -86,8 +93,14 @@ public:
|
||||
this->current -= v;
|
||||
return *this;
|
||||
}
|
||||
pointer_iterator operator+(int v) const { return pointer_iterator(this->current + v); }
|
||||
pointer_iterator operator-(int v) const { return pointer_iterator(this->current - v); }
|
||||
pointer_iterator operator+(int v) const {
|
||||
pointer_iterator it = *this;
|
||||
return it += v;
|
||||
}
|
||||
pointer_iterator operator-(int v) const {
|
||||
pointer_iterator it = *this;
|
||||
return it -= v;
|
||||
}
|
||||
};
|
||||
} // namespace rstl
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
inline const_iterator end() const { return const_iterator(data() + x0_count); }
|
||||
|
||||
reserved_vector() : x0_count(0) {}
|
||||
reserved_vector(const T& value) : x0_count(N) { rstl::uninitialized_fill_n(data(), N, value); }
|
||||
// reserved_vector(const T& value) : x0_count(N) { rstl::uninitialized_fill_n(data(), N, value); }
|
||||
reserved_vector(const reserved_vector& other) {
|
||||
x0_count = other.size();
|
||||
// rstl::uninitialized_copy_n(other.data(), size(), data());
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
}
|
||||
|
||||
void reserve(int size);
|
||||
void resize(int size, const T& in);
|
||||
iterator erase(iterator it);
|
||||
|
||||
void push_back(const T& in) {
|
||||
@@ -118,6 +119,19 @@ public:
|
||||
inline const T& operator[](int idx) const { return xc_items[idx]; }
|
||||
};
|
||||
|
||||
template < typename T, typename Alloc >
|
||||
void vector< T, Alloc >::resize(int size, const T& in) {
|
||||
if (x4_count != size) {
|
||||
if (size > x4_count) {
|
||||
reserve(size);
|
||||
uninitialized_fill_n(xc_items + x4_count, size - x4_count, in);
|
||||
} else {
|
||||
destroy(begin() + size, end());
|
||||
}
|
||||
x4_count = size;
|
||||
}
|
||||
}
|
||||
|
||||
template < typename T, typename Alloc >
|
||||
void vector< T, Alloc >::reserve(int size) {
|
||||
if (size <= x8_capacity)
|
||||
|
||||
Reference in New Issue
Block a user