mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Revert "Improve ImVec2 subscript helper"
This reverts commit 75b044c690.
This commit is contained in:
parent
dde5b8a487
commit
4707b7e732
1 changed files with 2 additions and 2 deletions
4
imgui.h
4
imgui.h
|
|
@ -297,8 +297,8 @@ struct ImVec2
|
||||||
float x, y;
|
float x, y;
|
||||||
constexpr ImVec2() : x(0.0f), y(0.0f) { }
|
constexpr ImVec2() : x(0.0f), y(0.0f) { }
|
||||||
constexpr ImVec2(float _x, float _y) : x(_x), y(_y) { }
|
constexpr ImVec2(float _x, float _y) : x(_x), y(_y) { }
|
||||||
float& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return idx == 0 ? x : y; } // We very rarely use this [] operator, so the assert overhead is fine.
|
float& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return ((float*)(void*)(char*)this)[idx]; } // We very rarely use this [] operator, so the assert overhead is fine.
|
||||||
float operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return idx == 0 ? x : y; }
|
float operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return ((const float*)(const void*)(const char*)this)[idx]; }
|
||||||
#ifdef IM_VEC2_CLASS_EXTRA
|
#ifdef IM_VEC2_CLASS_EXTRA
|
||||||
IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2.
|
IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue