X Tutup
Skip to content

Add a const version of List::find#112660

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
aaronfranke:list-find-const
Nov 12, 2025
Merged

Add a const version of List::find#112660
Repiteo merged 1 commit intogodotengine:masterfrom
aaronfranke:list-find-const

Conversation

@aaronfranke
Copy link
Member

This is the exact same as the existing List::find, but has const added to the iterator, return type, and function signature, allowing using List::find on const Lists. Previously, those lists would have to be non-const to use this function.

I previously had this slipped into other PRs because it's a minor addition, but @Ivorforce suggested it was out of scope elsewhere, so I am opening a dedicated PR for this (see #111372 (comment)).

@aaronfranke aaronfranke requested a review from a team as a code owner November 12, 2025 08:49
@aaronfranke aaronfranke added this to the 4.6 milestone Nov 12, 2025
Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
This is needed because otherwise, callers of .find are forced to make their own method non-const (or the field mutable).
From what I've seen contributors do, i wouldn't be surprised if this already happened. Somehow, people often avoid fixing the underlying issue, piling a duct tape solution on top...

@Repiteo Repiteo merged commit df51b14 into godotengine:master Nov 12, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 12, 2025

Thanks!

@aaronfranke aaronfranke deleted the list-find-const branch November 12, 2025 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup