8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 15:23:02 +01:00

Fix for Alex's removeRange & removeCount methods in Array class.

This commit is contained in:
robocop 2005-11-18 05:31:25 +00:00
parent b84e03f467
commit 41e13ca1b1

View File

@ -163,12 +163,12 @@ public:
void removeRange(size_t from, size_t to) { void removeRange(size_t from, size_t to) {
fb_assert(from <= to); fb_assert(from <= to);
fb_assert(to <= count); fb_assert(to <= count);
memmove(data + from, data + to, sizeof(T) * (to - from)); memmove(data + from, data + to, sizeof(T) * (count - to));
count -= (to - from); count -= (to - from);
} }
void removeCount(size_t index, size_t n) { void removeCount(size_t index, size_t n) {
fb_assert(index + n <= count); fb_assert(index + n <= count);
memmove(data + index, data + index + n, sizeof(T) * n); memmove(data + index, data + index + n, sizeof(T) * (count - index - n));
count -= n; count -= n;
} }
void remove(T* itr) { void remove(T* itr) {