Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add begin,end support for glm #1344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZXShady
Copy link

@ZXShady ZXShady commented Feb 13, 2025

This pr adds glm::begin,glm::end,glm::rbegin,glm::rend to allow for usage with iterators and importantly ranged based for loop.

This function is overloaded for vec,mat,qua types.

Example uses of this pr

int total = 0;
for(auto& elem : vec) {
   total += elem;
}

// find elem
auto it = std::find(begin(vec),end(vec),21);

This differs from PR #1327 because it overloads the functions with specilized templated types and not just a template parameter therefore it allows proper ADL. and also it adds rbegin and rend

@AbitTheGray
Copy link

I would still argue for using "gtc/type_trait.hpp" (as I did in #1327 ), or something similar, instead of different values you've used in end (I especially don't like the 4 there, even tho it will never change).

@ZXShady
Copy link
Author

ZXShady commented Feb 14, 2025

I would still argue for using "gtc/type_trait.hpp" (as I did in #1327 ), or something similar, instead of different values you've used in end (I especially don't like the 4 there, even tho it will never change).

why? it just seems unnecessary when I can just calculate it inline since I already need to explicitly specify the template class for ADL to work. I didn't even want to provide it for qua but it would seem inconsistent so I hesitated to remove it

@AbitTheGray

@ZXShady ZXShady force-pushed the iteration_support branch 4 times, most recently from 6781223 to dfa8e03 Compare February 15, 2025 11:40
@ZXShady
Copy link
Author

ZXShady commented Feb 15, 2025

Fixed the #ifdef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants