mirror of https://github.com/PrimeDecomp/prime.git
parent
f344adf167
commit
0185a7b1a8
|
@ -120,6 +120,11 @@ struct const_counting_iterator {
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
const_counting_iterator(const T* ptr, int count) : ptr(ptr), count(count) {}
|
const_counting_iterator(const T* ptr, int count) : ptr(ptr), count(count) {}
|
||||||
|
|
||||||
|
const_counting_iterator& operator++() {
|
||||||
|
++this->count;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template < typename It >
|
template < typename It >
|
||||||
|
|
|
@ -137,8 +137,11 @@ void vector< T, Alloc >::reserve(int newSize) {
|
||||||
template < typename T, typename Alloc >
|
template < typename T, typename Alloc >
|
||||||
typename vector< T, Alloc >::iterator vector< T, Alloc >::insert(iterator it, const T& value) {
|
typename vector< T, Alloc >::iterator vector< T, Alloc >::insert(iterator it, const T& value) {
|
||||||
typename iterator::difference_type diff = it - begin(); // distance(begin(), it);
|
typename iterator::difference_type diff = it - begin(); // distance(begin(), it);
|
||||||
const_counting_iterator< T > in(&value, 0);
|
|
||||||
insert_into(it, 1, in);
|
// // TODO: implement
|
||||||
|
// const_counting_iterator< T > in(&value, 0);
|
||||||
|
// insert_into(it, 1, in);
|
||||||
|
|
||||||
return begin() + diff;
|
return begin() + diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +173,8 @@ typename vector< T, Alloc >::iterator vector< T, Alloc >::insert_into(iterator a
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
int newCapacity = x8_capacity != 0 ? x8_capacity * 2 : 4;
|
int newCapacity = x8_capacity != 0 ? x8_capacity * 2 : 4;
|
||||||
for (; newCapacity < newCount; newCapacity *= 2);
|
for (; newCapacity < newCount; newCapacity *= 2)
|
||||||
|
;
|
||||||
T* newData;
|
T* newData;
|
||||||
x0_allocator.allocate(newData, newCapacity);
|
x0_allocator.allocate(newData, newCapacity);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "rstl/math.hpp"
|
#include "rstl/math.hpp"
|
||||||
|
#include "rstl/iterator.hpp"
|
||||||
|
|
||||||
namespace rstl {
|
namespace rstl {
|
||||||
static int string_find(const string& haystack, const string& needle, int) {
|
static int string_find(const string& haystack, const string& needle, int) {
|
||||||
|
|
Loading…
Reference in New Issue