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.
With the exception of performance-no-int-to-ptr, this change enables clang tidy's performance-based lints.
The changes made are as follows, in no particular order.
const T&
instead ofT
, since it avoids a copy.std::move
to avoid a copy. However, if the type is trivially copyable,std::move
does nothing and hence should be removed. Furthermore, if the variable to be moved is constant,std::move
simply copies, and sostd::move
is confusing and should be removed. Finally, if the variable is moved, but the function parameter type isconst T&
, then a move is unnecessary, and again, it should be removed.push_back
in a loop, we should reserve up front for better performance.std::move()
the strings, or usestring::append
. Otherwise, we pay the price of creating temporary strings, instead of just pushing to a single string.= default
to allow more aggressive compiler optimizations.