ImVector: Spacing.

docking
omar 7 years ago
parent 8e8b5498f7
commit 69879dd4f3

@ -1018,10 +1018,10 @@ public:
typedef value_type* iterator; typedef value_type* iterator;
typedef const value_type* const_iterator; typedef const value_type* const_iterator;
ImVector() { Size = Capacity = 0; Data = NULL; } inline ImVector() { Size = Capacity = 0; Data = NULL; }
~ImVector() { if (Data) ImGui::MemFree(Data); } inline ~ImVector() { if (Data) ImGui::MemFree(Data); }
ImVector(const ImVector<T>& rhs) { Size = Capacity = 0; Data = NULL; if (rhs.Size) { resize(rhs.Size); memcpy(Data, rhs.Data, (size_t)rhs.Size * sizeof(T)); } } inline ImVector(const ImVector<T>& rhs) { Size = Capacity = 0; Data = NULL; if (rhs.Size) { resize(rhs.Size); memcpy(Data, rhs.Data, (size_t)rhs.Size * sizeof(T)); } }
ImVector<T>& operator=(const ImVector<T>& rhs) { resize(rhs.Size); if (rhs.Size) memcpy(Data, rhs.Data, (size_t)rhs.Size * sizeof(T)); return *this; } inline ImVector<T>& operator=(const ImVector<T>& rhs) { resize(rhs.Size); if (rhs.Size) memcpy(Data, rhs.Data, (size_t)rhs.Size * sizeof(T)); return *this; }
inline bool empty() const { return Size == 0; } inline bool empty() const { return Size == 0; }
inline int size() const { return Size; } inline int size() const { return Size; }
@ -1047,7 +1047,8 @@ public:
inline void resize(int new_size, const T& v){ if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) Data[n] = v; Size = new_size; } inline void resize(int new_size, const T& v){ if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) Data[n] = v; Size = new_size; }
inline void reserve(int new_capacity) inline void reserve(int new_capacity)
{ {
if (new_capacity <= Capacity) return; if (new_capacity <= Capacity)
return;
T* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(T)); T* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(T));
if (Data) if (Data)
memcpy(new_data, Data, (size_t)Size * sizeof(T)); memcpy(new_data, Data, (size_t)Size * sizeof(T));

Loading…
Cancel
Save