mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
gd::vector::erase for android (#906)
* gd::vector::erase for android * oops
This commit is contained in:
parent
723ff87f06
commit
c3c2afaac8
1 changed files with 32 additions and 2 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue