-
-
Notifications
You must be signed in to change notification settings - Fork 642
Add support for range based loops for Array #1717
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 support for range based loops for Array #1717
Conversation
Thanks! However, one of godot-cpp's core design goals is to be compatible with Godot's internal APIs, and this differs a little bit from them:
|
Changed the PR to now add the iterator to Array instead of TypedArray, I can make the I think |
Thanks!
The goal isn't to be internally consistent among the classes in godot-cpp, but to be consistent with the API of Godot. In Godot, the PackedArray classes have public Also, lots of extensions are already using |
@dsnopek cool, the Array's |
Is this PR waiting on anything? @dsnopek do you have any other concerns? |
Thanks, this is looking good to me now! Only one last thing - this needs to be squashed to a single commit per Godot's git workflow: https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html#the-interactive-rebase (This applies to all your PRs, actually - sorry that I didn't notice earlier that you were making multiple commits) |
4eca894
to
a2c37f8
Compare
Ahh no worries, I should have read the PR guidelines more thoroughly, should be good to go now |
Fixes #1710
This PR adds support for range based loops for the TypedArray class.
Allowing syntax such as:
I wanted to get proper type inference for the element, but I had issues getting the Variant type to cast properly.