Skip to content

Use emplace_front in filesystem#3279

Merged
StephanTLavavej merged 1 commit intomicrosoft:mainfrom
SiliconA-Z:emplace
Dec 15, 2022
Merged

Use emplace_front in filesystem#3279
StephanTLavavej merged 1 commit intomicrosoft:mainfrom
SiliconA-Z:emplace

Conversation

@SiliconA-Z
Copy link
Contributor

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

@SiliconA-Z SiliconA-Z requested a review from a team as a code owner December 10, 2022 16:17
@SiliconA-Z SiliconA-Z 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