Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::string_view for C++ Lang handling #5605

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

sturnclaw
Copy link
Member

Refactor the C++-side Lang:: APIs to be more efficient with less string copies.

This is a minor prerequisite change for my editor branch and will be merged quickly.

Instead of making a copy when accessing a Lang resource, simply return a reference.

This avoids potentially significant amounts of overhead when utilizing Lang Resources from C++ as well as when retrieving resources from Lua.
Resource::Get() still returns a const reference to std::string to avoid needing to update callsites.
@sturnclaw sturnclaw merged commit 1599de9 into pioneerspacesim:master Aug 25, 2023
5 checks passed
@sturnclaw sturnclaw deleted the lang-string-view branch August 25, 2023 20:51
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.

1 participant