Fixed compatibility with std::vector if user decide to #define ImVector

This commit is contained in:
ocornut
2014-11-20 08:15:21 +00:00
parent 9f2545e6bb
commit 2aee4419e3
4 changed files with 9 additions and 8 deletions

View File

@ -573,8 +573,8 @@ struct ImGuiTextBuffer
ImGuiTextBuffer() { Buf.push_back(0); }
~ImGuiTextBuffer() { clear(); }
const char* begin() const { return Buf.begin(); }
const char* end() const { return Buf.end()-1; }
const char* begin() const { return &Buf.front(); }
const char* end() const { return &Buf.back(); } // Buf is zero-terminated, so end() will point on the zero-terminator
size_t size() const { return Buf.size()-1; }
bool empty() { return Buf.empty(); }
void clear() { Buf.clear(); Buf.push_back(0); }