-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add a table listing STL datatypes and their Godot equivalents in C++ usage guidelines #10873
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
base: master
Are you sure you want to change the base?
Add a table listing STL datatypes and their Godot equivalents in C++ usage guidelines #10873
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot! I think a table like this could be really helpful to get people started with the codebase.
As I was reading this, I was thinking that perhaps it might be better to structure it by Godot datatype than STL datatype? That would allow us to add some more nuance.
Godot Datatype | Closest STL datatype | Comments
Vector | std::vector | Uses copy-on-write semantics. That means it's generally slower but can be copied around almost for free.
etc.
What do you think?
9637bd2
to
af319b9
Compare
Done 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving the addition, the other feedback still applies :) Thanks for working on this!
…usage guidelines This is more comprehensive than the previous advice.
af319b9
to
7724b0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great! I'm happy we finally have a reference point for this info
+------------------------+--------------------------+--------------------------------------------------------------------------------------+ | ||
| ``HashSet`` | ``std::unordered_set`` | **Use this as the "default" set type.** | | ||
+------------------------+--------------------------+--------------------------------------------------------------------------------------+ | ||
| ``RBSet`` | ``std::unordered_set`` | Uses a `red-black tree <https://en.wikipedia.org/wiki/Red-black_tree>`__ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ``RBSet`` | ``std::unordered_set`` | Uses a `red-black tree <https://en.wikipedia.org/wiki/Red-black_tree>`__ | | |
| ``RBSet`` | ``std::set`` | Uses a `red-black tree <https://en.wikipedia.org/wiki/Red-black_tree>`__ | |
This was correctly in that sense, also I think a description of RBMap
is needed as well, might also want to describe VSet
and VMap
, which are equivalent to std::flat_set/map
(which are in C++23, or in Boost)
This is more comprehensive than the previous advice.
@Ivorforce Could you take a look at this? There are probably some inaccuracies in here, as I'm not fully up-to-date on which scenarios are most optimal for each datatype. I also don't know whether OAHashMap, AHashMap and HashMap all preserve insertion order or only some of them (the class comments don't make an explicit notice of this).