mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
ImVector<> cannot be re-defined (#262)
This commit is contained in:
parent
b92396b46a
commit
02dbcf5405
@ -6,11 +6,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//---- Define your own ImVector<> type if you don't want to use the provided implementation defined in imgui.h
|
|
||||||
//#include <vector>
|
|
||||||
//#define ImVector std::vector
|
|
||||||
//#define ImVector MyVector
|
|
||||||
|
|
||||||
//---- Define assertion handler. Defaults to calling assert().
|
//---- Define assertion handler. Defaults to calling assert().
|
||||||
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
||||||
|
|
||||||
|
5
imgui.h
5
imgui.h
@ -77,7 +77,7 @@ struct ImVec4
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helpers at bottom of the file:
|
// 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)
|
// - 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 ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
||||||
// - struct ImGuiTextBuffer // Text buffer for logging/accumulating text
|
// - 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).
|
// 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!
|
// 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<typename T>
|
template<typename T>
|
||||||
class ImVector
|
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 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; }
|
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
|
// 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.
|
// Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
|
||||||
|
Loading…
Reference in New Issue
Block a user