// inline void swap(ImVector<T>& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; T* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } public void swap(ref ImVector <T> rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; T *rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }
// inline ImVector() { Size = Capacity = 0; Data = NULL; } // Default .NET behavior // inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); } // inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; } public ImVector(ImVector <T> src) { this = default; resize(src.Size); src.AsSpan().CopyTo(this.AsSpan()); }