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

Function _grow_capacity

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

Source from the content-addressed store, hash-verified

1871 inline void swap(ImVector<T>& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; T* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }
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

Callers 3

resizeFunction · 0.85
push_backFunction · 0.85
insertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected