MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / resize

Function resize

extern/imgui/imgui.h:1874–1874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1872
1873 inline int _grow_capacity(int sz) const { int new_capacity = Capacity ? (Capacity + Capacity / 2) : 8; return new_capacity > sz ? new_capacity : sz; }
1874 inline void resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }
1875 inline void resize(int new_size, const T& v) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; }
1876 inline void shrink(int new_size) { IM_ASSERT(new_size <= Size); Size = new_size; } // Resize a vector to a smaller size, guaranteed not to cause a reallocation
1877 inline void reserve(int new_capacity) { if (new_capacity <= Capacity) return; T* new_data = (T*)IM_ALLOC((size_t)new_capacity * sizeof(T)); if (Data) { memcpy(new_data, Data, (size_t)Size * sizeof(T)); IM_FREE(Data); } Data = new_data; Capacity = new_capacity; }

Callers 1

imgui.hFile · 0.70

Calls 2

_grow_capacityFunction · 0.85
reserveFunction · 0.70

Tested by

no test coverage detected