mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[12632] Revert previous commit (see Notes)
This commit is contained in:
parent
1cd806c02e
commit
ef445ea523
1462 changed files with 9689 additions and 7080 deletions
|
|
@ -2,9 +2,9 @@
|
|||
@file SmallArray.h
|
||||
|
||||
@created 2009-04-26
|
||||
@edited 2009-04-26
|
||||
@edited 2010-02-26
|
||||
|
||||
Copyright 2000-2009, Morgan McGuire, http://graphics.cs.williams.edu
|
||||
Copyright 2000-2010, Morgan McGuire, http://graphics.cs.williams.edu
|
||||
All rights reserved.
|
||||
*/
|
||||
#ifndef G3D_SmallArray_h
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "G3D/platform.h"
|
||||
#include "G3D/Array.h"
|
||||
#include "G3D/MemoryManager.h"
|
||||
|
||||
namespace G3D {
|
||||
|
||||
|
|
@ -46,6 +47,11 @@ public:
|
|||
resize(0, shrinkIfNecessary);
|
||||
}
|
||||
|
||||
void clearAndSetMemoryManager(MemoryManager::Ref& m) {
|
||||
clear();
|
||||
m_rest.clearAndSetMemoryManager(m);
|
||||
}
|
||||
|
||||
inline T& operator[](int i) {
|
||||
debugAssert(i < m_size && i >= 0);
|
||||
if (i < N) {
|
||||
|
|
@ -77,7 +83,7 @@ public:
|
|||
push(v);
|
||||
}
|
||||
|
||||
void fastRemove(int i) {
|
||||
void fastRemove(int i, bool shrinkIfNecessary = false) {
|
||||
debugAssert(i < m_size && i >= 0);
|
||||
if (i < N) {
|
||||
if (m_size <= N) {
|
||||
|
|
@ -89,7 +95,7 @@ public:
|
|||
}
|
||||
} else {
|
||||
// Removing from the rest array
|
||||
m_rest.fastRemove(i - N);
|
||||
m_rest.fastRemove(i - N, shrinkIfNecessary);
|
||||
}
|
||||
--m_size;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue