From 02dbcf540523872ea58a861c2c0b8df027604b7b Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 7 Jul 2015 11:27:22 -0600 Subject: [PATCH] ImVector<> cannot be re-defined (#262) --- imconfig.h | 5 ----- imgui.h | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/imconfig.h b/imconfig.h index 8573ebd5..21eb3f25 100644 --- a/imconfig.h +++ b/imconfig.h @@ -6,11 +6,6 @@ #pragma once -//---- Define your own ImVector<> type if you don't want to use the provided implementation defined in imgui.h -//#include -//#define ImVector std::vector -//#define ImVector MyVector - //---- Define assertion handler. Defaults to calling assert(). //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) diff --git a/imgui.h b/imgui.h index 3b64677d..bcdec423 100644 --- a/imgui.h +++ b/imgui.h @@ -77,7 +77,7 @@ struct ImVec4 }; // Helpers at bottom of the file: -// - class ImVector<> // Lightweight std::vector like class. Use '#define ImVector std::vector' if you want to use the STL type or your own type. +// - class ImVector<> // Lightweight std::vector like class. // - IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times) // - struct ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" // - struct ImGuiTextBuffer // Text buffer for logging/accumulating text @@ -737,9 +737,7 @@ struct ImGuiIO //----------------------------------------------------------------------------- // Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug). -// Use '#define ImVector std::vector' if you want to use the STL type or your own type. // Our implementation does NOT call c++ constructors because we don't use them in ImGui. Don't use this class as a straight std::vector replacement in your code! -#ifndef ImVector template class ImVector { @@ -795,7 +793,6 @@ public: inline iterator erase(const_iterator it) { IM_ASSERT(it >= begin() && it < end()); const ptrdiff_t off = it - begin(); memmove(Data + off, Data + off + 1, (Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; } inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= begin() && it <= end()); const ptrdiff_t off = it - begin(); if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, (Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; } }; -#endif // #ifndef ImVector // Helper: execute a block of code once a frame only // Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.