X Tutup
Skip to content

Add inline documentation to Vector::reserve and Vector::reserve_exact.#114563

Merged
akien-mga merged 1 commit intogodotengine:masterfrom
Ivorforce:vector-reserve-doc
Jan 5, 2026
Merged

Add inline documentation to Vector::reserve and Vector::reserve_exact.#114563
akien-mga merged 1 commit intogodotengine:masterfrom
Ivorforce:vector-reserve-doc

Conversation

@Ivorforce
Copy link
Member

These functions are not inherently clear and should be documented (especially regarding their difference).

As template functions, the most appropriate place is in-line with the code (as with other methods in the same class).
Other templates (outside CowData, which is not commonly used directly), no other type offers reserve_exact yet.

@Ivorforce Ivorforce added this to the 4.x milestone Jan 3, 2026
@Ivorforce Ivorforce requested a review from a team as a code owner January 3, 2026 15:54
@Ivorforce Ivorforce force-pushed the vector-reserve-doc branch 2 times, most recently from 9911ee1 to 4d35512 Compare January 3, 2026 15:56
}

/// Reserves capacity for at least p_size total elements.
/// You can call this before repeated insertions to improve performance.
Copy link
Member

Choose a reason for hiding this comment

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

I would add a note that this follows the 1.5x growth pattern and may reserve more than what is asked for.

Similarly I would clarify below that reserve exact only reserves exactly what is asked for and may be sub optimal if called repeatedly

Copy link
Member Author

Choose a reason for hiding this comment

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

I rephrased and added some more detail. Does this help?

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Looks great!

@clayjohn clayjohn modified the milestones: 4.x, 4.6 Jan 3, 2026
@akien-mga akien-mga merged commit dcaf853 into godotengine:master Jan 5, 2026
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@Ivorforce Ivorforce deleted the vector-reserve-doc branch January 5, 2026 11:12
rivie13 pushed a commit to rivie13/Phoenix-Agentic-Engine that referenced this pull request Feb 16, 2026
Add inline documentation to `Vector::reserve` and `Vector::reserve_exact`.
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