MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Expand

Method Expand

Source/ThirdParty/rapidjson/internal/stack.h:195–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193private:
194 template<typename T>
195 void Expand(size_t count) {
196 // Only expand the capacity if the current stack exists. Otherwise just create a stack with initial capacity.
197 size_t newCapacity;
198 if (stack_ == 0) {
199 if (!allocator_)
200 ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
201 newCapacity = initialCapacity_;
202 } else {
203 newCapacity = GetCapacity();
204 newCapacity += (newCapacity + 1) / 2;
205 }
206 size_t newSize = GetSize() + sizeof(T) * count;
207 if (newCapacity < newSize)
208 newCapacity = newSize;
209
210 Resize(newCapacity);
211 }
212
213 void Resize(size_t newCapacity) {
214 const size_t size = GetSize(); // Backup the current size

Callers

nothing calls this directly

Calls 2

GetSizeFunction · 0.50
ResizeFunction · 0.50

Tested by

no test coverage detected