[*] Fix remove range
This commit is contained in:
parent
122fc74a66
commit
b16f8613d8
@ -113,14 +113,13 @@ inline void AuRemoveRange(T &in, AuUInt index, AuUInt length)
|
||||
}
|
||||
|
||||
auto begin = in.begin();
|
||||
auto end = begin;
|
||||
|
||||
std::advance(begin, index);
|
||||
std::advance(end, index + length);
|
||||
|
||||
while (begin != end)
|
||||
for (AuUInt i = 0; i < length; i++)
|
||||
{
|
||||
in.erase(begin++);
|
||||
begin = in.erase(begin);
|
||||
if (begin == in.end()) break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,14 +134,13 @@ inline bool AuTryRemoveRange(T &in, AuUInt index, AuUInt length)
|
||||
}
|
||||
|
||||
auto begin = in.begin();
|
||||
auto end = begin;
|
||||
|
||||
std::advance(begin, index);
|
||||
std::advance(end, index + length);
|
||||
|
||||
while (begin != end)
|
||||
for (AuUInt i = 0; i < length; i++)
|
||||
{
|
||||
in.erase(begin++);
|
||||
begin = in.erase(begin);
|
||||
if (begin == in.end()) return i == length - 1;
|
||||
}
|
||||
}
|
||||
AUROXTL_COMMODITY_CATCH
|
||||
|
Loading…
Reference in New Issue
Block a user