gd::vector::erase for android (#906)

* gd::vector::erase for android

* oops
This commit is contained in:
SpaghettDev 2024-06-16 15:45:47 +01:00 committed by GitHub
parent 723ff87f06
commit c3c2afaac8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -287,6 +287,8 @@ namespace gd {
class GEODE_DLL vector {
public:
using value_type = T;
using iterator = T*;
using const_iterator = const T*;
auto allocator() const {
return gd::allocator<T>();
@ -302,10 +304,10 @@ namespace gd {
m_reserveEnd = nullptr;
}
size_t nextCapacity(size_t x) {
std::size_t nextCapacity(std::size_t x) {
// minimum 16, powers of 2, don't use builtins
if (x < 16) return 16;
size_t out = 16;
std::size_t out = 16;
while (out < x) {
out *= 2;
}
@ -410,6 +412,34 @@ namespace gd {
}
}
iterator erase(iterator pos)
{
return erase(pos, pos + 1);
}
iterator erase(const_iterator pos)
{
return erase(pos, pos + 1);
}
iterator erase(iterator first, iterator last)
{
std::move(last, m_finish, first);
--m_finish;
return first;
}
iterator erase(const_iterator first, const_iterator last)
{
std::move(last, m_finish, first);
--m_finish;
return first;
}
void push_back(T const& input) {
this->grow();