| 90 | } |
| 91 | |
| 92 | void Reserve(int newSize) |
| 93 | { |
| 94 | if (newSize >= this->Allocated) |
| 95 | { |
| 96 | int oldSize = this->Allocated; |
| 97 | this->Allocated = newSize + DEFAULTINCREMENT; |
| 98 | T* temp = this->Data; |
| 99 | if (!this->UseNew) |
| 100 | { |
| 101 | // NOLINTNEXTLINE(bugprone-sizeof-expression) |
| 102 | void* mem = vtkVRMLAllocator::AllocateMemory(this->Allocated * sizeof(T)); |
| 103 | this->Data = new (mem) T[this->Allocated]; |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | this->Data = new T[this->Allocated]; |
| 108 | } |
| 109 | if (this->Data == (T*)'\0') |
| 110 | { |
| 111 | return; |
| 112 | } |
| 113 | // NOLINTNEXTLINE(bugprone-sizeof-expression) |
| 114 | memcpy((void*)this->Data, (void*)temp, oldSize * sizeof(T)); |
| 115 | if (this->UseNew) |
| 116 | { |
| 117 | delete[] temp; |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | void Demand(int newSize) |
| 123 | { |
no test coverage detected