Avoid unnecessary shared_ptr
copies and simplify static initialization
#505
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Untested, but the behaviour should be the same unless I am missing something. Basically, I've changed some
auto
toauto&
to avoid an unnecessarystd::shared_ptr
copy, and also simplified the initialization of somestatic
function-scope variables, as I don't think that an extra check was needed (again, unless I am missing something).Will likely have no significant impact on performance but if many
std::shared_ptr
copies were being unnecessarily made per-frame then it might actually reduce CPU usage a bit.Also, (again -- I might be missing something), all of these
::get()
functions maybe do not even need shared pointers at all. E.g. how about:?