Skip to content

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

@ZXShady ZXShady force-pushed the iteration_support branch 2 times, most recently from 6a2dde9 to c39065b Compare February 15, 2025 14:09
@christophe-lunarg
Copy link

Thanks for contributing!

@christophe-lunarg christophe-lunarg merged commit 65a83c9 into g-truc:master Oct 6, 2025
68 checks passed
@ZXShady
Copy link
Author

ZXShady commented Oct 6, 2025

Thanks for accepting my pull request 🙂

@ZXShady ZXShady deleted the iteration_support branch November 10, 2025 16:21
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.

3 participants