mirror of https://github.com/PrimeDecomp/prime.git
Properly make vector::operator= not inline
Former-commit-id: 47163e0f4e
This commit is contained in:
parent
a2260d9e4f
commit
f7e6ddea87
|
@ -77,22 +77,7 @@ public:
|
||||||
++x4_count;
|
++x4_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector& operator=(const vector& other); /* {
|
vector& operator=(const vector& other);
|
||||||
if (this == &other)
|
|
||||||
return *this;
|
|
||||||
clear();
|
|
||||||
if (other.size() == 0) {
|
|
||||||
x0_allocator.deallocate(xc_items);
|
|
||||||
x4_count = 0;
|
|
||||||
x8_capacity = 0;
|
|
||||||
xc_items = nullptr;
|
|
||||||
} else {
|
|
||||||
reserve(other.size());
|
|
||||||
uninitialized_copy(other.data(), other.data() + other.size(), data());
|
|
||||||
x4_count = other.x4_count;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
destroy(begin(), end());
|
destroy(begin(), end());
|
||||||
|
@ -116,12 +101,12 @@ public:
|
||||||
protected:
|
protected:
|
||||||
template < typename In >
|
template < typename In >
|
||||||
void insert_into(iterator at, int n, In in) {
|
void insert_into(iterator at, int n, In in) {
|
||||||
int insertAt = xc_items + n;
|
// int insertAt = xc_items + n;
|
||||||
if (x8_capacity < insertAt) {
|
// TODO: finish
|
||||||
|
if (x8_capacity < n) {
|
||||||
int newCapacity = x8_capacity != 0 ? x8_capacity * 2 : 4;
|
int newCapacity = x8_capacity != 0 ? x8_capacity * 2 : 4;
|
||||||
T* newData;
|
T* newData;
|
||||||
x0_allocator.allocate(newData, newCapacity);
|
x0_allocator.allocate(newData, newCapacity);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -160,6 +145,25 @@ typename vector< T, Alloc >::iterator vector< T, Alloc >::insert(iterator it, co
|
||||||
return begin() + diff;
|
return begin() + diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename T, typename Alloc >
|
||||||
|
vector< T, Alloc >& vector< T, Alloc >::operator=(const vector< T, Alloc >& other) {
|
||||||
|
if (this == &other)
|
||||||
|
return *this;
|
||||||
|
clear();
|
||||||
|
if (other.size() == 0) {
|
||||||
|
x0_allocator.deallocate(xc_items);
|
||||||
|
x4_count = 0;
|
||||||
|
x8_capacity = 0;
|
||||||
|
xc_items = nullptr;
|
||||||
|
} else {
|
||||||
|
reserve(other.size());
|
||||||
|
uninitialized_copy(other.data(), other.data() + other.size(), data());
|
||||||
|
x4_count = other.x4_count;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef vector< void > unk_vector;
|
typedef vector< void > unk_vector;
|
||||||
CHECK_SIZEOF(unk_vector, 0x10)
|
CHECK_SIZEOF(unk_vector, 0x10)
|
||||||
} // namespace rstl
|
} // namespace rstl
|
||||||
|
|
Loading…
Reference in New Issue