|
|
|
@ -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;
|
|
|
|
|
|
|
|
|
|