g-truc / glm

OpenGL Mathematics (GLM)
https://glm.g-truc.net
Other
9.34k stars 2.14k forks source link

Add C++17 Structured Bindings Support for r,g,b,a and s,t,p,q Member Vectors and Mat and Quat #1320

Open ZXShady opened 2 weeks ago

ZXShady commented 2 weeks ago

This PR introduces structured bindings support for improved readability and allows for more concise code Key Changes:

// After auto [w, h] = obj.getSize();


```cpp
glm::vec3 v;
auto [x,y,z] = v; // used to be an error unless GLM_FORCE_MEMBERS_XYZW was defined

Structured bindings make the code more readable, especially when accessing multiple members of an temporary from a function call. It reduces verbosity.