mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Fixed ImVec2 operator[] violating aliasing rules causing issue with Intel C++ compiler. (#6272)
Note that this is not BayesBug's exact intended solution, so issues would be my responsibility ;) Amended.
This commit is contained in:
parent
f65bcf481a
commit
a38e3c222f
@ -54,6 +54,8 @@ Other changes:
|
||||
- ColorEdit: Fixed shading of S/V triangle in Hue Wheel mode. (#5200, #6254) [@jamesthomasgriffin]
|
||||
- Rendering: Using adaptative tesselation for: RadioButton, ColorEdit preview circles,
|
||||
Windows Close and Collapse Buttons.
|
||||
- Misc: Fixed ImVec2 operator[] violating aliasing rules causing issue with Intel C++
|
||||
compiler. (#6272) [@BayesBug]
|
||||
- IO: Fixed support for calling io.AddXXXX functions fron inactive context (wrongly
|
||||
advertised as supported in 1.89.4). (#6199, #6256, #5856) [@cfillion]
|
||||
- Backends: OpenGL3: Fixed GL loader crash when GL_VERSION returns NULL. (#6154, #4445, #3530)
|
||||
|
4
imgui.h
4
imgui.h
@ -255,8 +255,8 @@ struct ImVec2
|
||||
float x, y;
|
||||
constexpr ImVec2() : x(0.0f), y(0.0f) { }
|
||||
constexpr ImVec2(float _x, float _y) : x(_x), y(_y) { }
|
||||
float operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine.
|
||||
float& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine.
|
||||
float& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return ((float*)(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 ((const float*)(const char*)this)[idx]; }
|
||||
#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.
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user