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 emplace_front in filesystem #3279

Merged
merged 1 commit into from
Dec 15, 2022
Merged

Conversation

AreaZR
Copy link
Contributor

@AreaZR AreaZR commented Dec 10, 2022

emplace_front would work better here than push_front, especially when we don't have to copy the object then

@AreaZR AreaZR requested a review from a team as a code owner December 10, 2022 16:17
@AreaZR AreaZR changed the title Use emplace_front Use emplace_front in filesystem Dec 10, 2022
Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me. Thanks!

@strega-nil-ms strega-nil-ms added the enhancement Something can be improved label Dec 12, 2022
@StephanTLavavej
Copy link
Member

Looks good to me. This is strictly simpler, and the scenario where replacing push_meow with emplace_meow is incorrect, doesn't apply here. (That's when the creation of a temporary is necessary for correctness - vector_of_unique_ptr.emplace_back(raw_pointer) is a leak.)

@StephanTLavavej StephanTLavavej self-assigned this Dec 15, 2022
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit c53fa69 into microsoft:main Dec 15, 2022
@StephanTLavavej
Copy link
Member

Thanks for finding and simplifying this code! ✨ 🎉 🐈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants