Repository navigation
[CODE HEALTH] Replace push_back with emplace_back where applicable (#4476) - #4485
Merged
Merged
Conversation
…4476) Use emplace_back instead of push_back to construct objects in-place, avoiding unnecessary temporary object creation and copy/move operations. Changes span test files, examples, exporters, and ext headers.
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4485 +/- ##
==========================================
+ Coverage 83.12% 83.13% +0.01%
==========================================
Files 519 519
Lines 20256 20256
==========================================
+ Hits 16835 16837 +2
+ Misses 3421 3419 -2
🚀 New features to boost your workflow:
|
dbarker
reviewed
Aug 26, 2026
dbarker
left a comment
Member
There was a problem hiding this comment.
Thanks for the fixes. Please update the .github/workflows/clang-tidy.yam with the new warning limits (113 and 124)
See the clang-tidy reports in the job summary from CI here:
https://github.com/open-telemetry/opentelemetry-cpp/actions/runs/32955276312?pr=4485
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Use
emplace_backinstead ofpush_backto construct objects in-place, avoiding unnecessary temporary object creation and copy/move operations. Changes span test files, examples, exporters, and ext headers.Fixes #4476
Changes
emplace_backforstd::string,context::Context,shared_ptr, andstd::threadconstructionotlp_file_client.cc: Useemplace_backfor string tokenshttp_server.h: Useemplace_backforHttpRequestHandlerconstructionsocket_tools.h: Useemplace_back()for default-constructedSocketDataemplace_backforstd::threadwith lambda argumentsChecklist
CHANGELOG.mdupdated for non-trivial changes