Skip to content

Commit

Permalink
Optionaly add compatibility operators
Browse files Browse the repository at this point in the history
  • Loading branch information
AThousandShips committed May 7, 2024
1 parent 5e26d7c commit 439f836
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/godot_cpp/templates/list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@ class List {
}
}

// 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) {
Expand All @@ -538,6 +543,11 @@ class List {
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 {
Expand Down

0 comments on commit 439f836

Please sign in to comment.