diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index ef8e231..92661ef 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -228,6 +228,7 @@ tree depth instead of a relative one. - Log/Capture: Fixed CollapsingHeader trailing ascii representation being "#" instead of "##". - ImFont: Added GetGlyphRangesVietnamese() helper. (#2403) +- Misc: ImVector: Added operator[] taking a size_t index. - Misc: Asserting in NewFrame() if style.WindowMinSize is zero or smaller than (1.0f,1.0f). - Demo: Using GetBackgroundDrawList() and GetForegroundDrawList() in "Custom Rendering" demo. - Demo: InputText: Demonstrating use of ImGuiInputTextFlags_CallbackResize. (#2006, #1443, #1008). diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index ef8e231..92661ef 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -228,6 +228,7 @@ tree depth instead of a relative one. - Log/Capture: Fixed CollapsingHeader trailing ascii representation being "#" instead of "##". - ImFont: Added GetGlyphRangesVietnamese() helper. (#2403) +- Misc: ImVector: Added operator[] taking a size_t index. - Misc: Asserting in NewFrame() if style.WindowMinSize is zero or smaller than (1.0f,1.0f). - Demo: Using GetBackgroundDrawList() and GetForegroundDrawList() in "Custom Rendering" demo. - Demo: InputText: Demonstrating use of ImGuiInputTextFlags_CallbackResize. (#2006, #1443, #1008). diff --git a/imgui.h b/imgui.h index 0cc13fb..d2b87ef 100644 --- a/imgui.h +++ b/imgui.h @@ -1240,6 +1240,8 @@ inline int capacity() const { return Capacity; } inline T& operator[](int i) { IM_ASSERT(i < Size); return Data[i]; } inline const T& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; } + inline T& operator[](size_t i) { IM_ASSERT(i < (size_t)Size); return Data[i]; } + inline const T& operator[](size_t i) const { IM_ASSERT(i < (size_t)Size); return Data[i]; } inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } } inline T* begin() { return Data; }