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

[range.dangling] Simplify syntax #4817

Merged
merged 1 commit into from Aug 18, 2021
Merged

Conversation

JohelEGP
Copy link
Contributor

No description provided.

@jensmaurer
Copy link
Member

jensmaurer commented Aug 18, 2021

Do we have a general policy here? I guess there are quite some places (e.g. std::make_unique) where "Args&&..." could be replaced by "auto&& ,.."

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Aug 18, 2021
@jwakely
Copy link
Member

jwakely commented Aug 18, 2021

std::forward? 🤨

I think it makes sense here because we don't need names for the types in the pack, it's just a sink accepting anything. Anywhere we need a name for the parameter (or parameter pack) using auto isn't an improvement.

@jensmaurer
Copy link
Member

std::forward -> std::make_unique; sorry for the confusion

@JohelEGP
Copy link
Contributor Author

That still uses std::forward, so we'd have to say std::forward<decltype(args)>(args)... instead of std::forward<Args>(args)....

@jensmaurer
Copy link
Member

Ok. So, the rule is we're only using "auto" as a parameter type if we don't need names. Makes sense.

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Aug 18, 2021
@jensmaurer jensmaurer merged commit ffb5fd3 into cplusplus:main Aug 18, 2021
@JohelEGP JohelEGP deleted the range.dangling branch August 18, 2021 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants