-
-
Notifications
You must be signed in to change notification settings - Fork 509
-
-
Notifications
You must be signed in to change notification settings - Fork 509
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
TypedArray<T> operator [] returning Variant makes little sence. #1482
Comments
This is a limitation and is the same as the engine, this should be tracked there as it has to be changed there first (and would change here as a follow up) But part of the problem is that it would have to replace the existing operator, that wouldn't be trivial as it inherits |
I also noticed this, and I agree that it would be really great if This seems fairly easy to do by modifying
This compiles and runs fine on my end, but I guess I do not know enough about the engine to understand if this causes any unintended side effects. However, if not, I would advocate this solution! |
That is not necessarily safe for non simple types, for example objects, or more importantly refs, you'd have problems with returning a So this is a bit more complicated, and there's issues involved in overloading operators etc. that might cause issues But you'd still have various other methods on |
Godot version
4.2
godot-cpp version
4.2
System information
Win 10
Issue description
When using TypedArray I think the one would expect that accessing entries with operator [] will return you variable of type T. Instead it returns Variant, which is loosing all point to use TypedArray in first place.
This should give compilation error:
As well as this construction is a bit annoying:
Steps to reproduce
Minimal reproduction project
The text was updated successfully, but these errors were encountered: