diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-05-07 10:43:41 +0200 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-05-07 11:01:37 +0200 |
commit | d0bdd6096c0440542245fb37690e7ab8f3e34b29 (patch) | |
tree | 1de828d4f0056a2f36015a5973ab554d17f39a3a /include/godot_cpp | |
parent | 12a128366312da9fc6b6157b4bd3081b522e0104 (diff) | |
download | redot-cpp-d0bdd6096c0440542245fb37690e7ab8f3e34b29.tar.gz |
Optionaly add compatibility operators
Diffstat (limited to 'include/godot_cpp')
-rw-r--r-- | include/godot_cpp/templates/list.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/godot_cpp/templates/list.hpp b/include/godot_cpp/templates/list.hpp index 55e2c35..fa59605 100644 --- a/include/godot_cpp/templates/list.hpp +++ b/include/godot_cpp/templates/list.hpp @@ -523,6 +523,11 @@ public: } } + // Index operator, kept for compatibility. + _FORCE_INLINE_ T &operator[](int p_index) { + return get(p_index); + } + // Random access to elements, use with care, // do not use for iteration. T &get(int p_index) { @@ -538,6 +543,11 @@ public: return I->get(); } + // Index operator, kept for compatibility. + _FORCE_INLINE_ const T &operator[](int p_index) const { + return get(p_index); + } + // Random access to elements, use with care, // do not use for iteration. const T &get(int p_index) const { |