diff --git a/imgui_internal.h b/imgui_internal.h index 4a8c79e6..4094fa6f 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -241,6 +241,7 @@ struct IMGUI_API ImPool T* Add() { int idx = FreeIdx; if (idx == Data.Size) { Data.resize(Data.Size + 1); FreeIdx++; } else { FreeIdx = *(int*)&Data[idx]; } IM_PLACEMENT_NEW(&Data[idx]) T(); return &Data[idx]; } void Remove(ImGuiID key, const T* p) { Remove(key, GetIndex(p)); } void Remove(ImGuiID key, int idx) { Data[idx].~T(); *(int*)&Data[idx] = FreeIdx; FreeIdx = idx; Map.SetInt(key, -1); } + void Reserve(int capacity) { Data.reserve(capacity); Map.Data.reserve(capacity); } }; typedef int ImPoolIdx;