Skip to content

Replace const std::vector& arguments with std::span#14500

Open
Sintendo wants to merge 1 commit intodolphin-emu:masterfrom
Sintendo:span2
Open

Replace const std::vector& arguments with std::span#14500
Sintendo wants to merge 1 commit intodolphin-emu:masterfrom
Sintendo:span2

Conversation

@Sintendo
Copy link
Copy Markdown
Member

std::span should be used instead of const std::vector& whenever possible:

  • std::span arguments can efficiently accept many different sequential memory types without needing to create a copy (plain C arrays, std::vector, and std::array).
  • As std::vector is itself a pointer to heap-allocated memory, passing a reference to one introduces an extra layer of indirection.

This PR replaces many such instances, although a few that are less trivial to refactor (e.g. CalculateDigest) remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants