-
Notifications
You must be signed in to change notification settings - Fork 7
Open
0 / 50 of 5 issues completedLabels
P3777new-proposalIdea/discussion for possible new proposalsIdea/discussion for possible new proposals
Milestone
Description
The idea is to have named parameters with similar syntax to designated initializers:
void f(int .x, int .y); // explicit opt-in
f(.y = 0, .x = 1);The benefits of this are:
- Less bug-prone uses of functions like
std::lerporstd::memcpy, where arguments are easily confused. - In general, being able to pass more parameters without getting confused, and with expressing intent at the call site.
- Avoiding magic numbers, like
f(.flag = true), without needing additional variables. - Massively simplifying overload resolution. For example,
std::ranges::all_of(.exec = /* ... */)would eliminate every algorithm that does not accept an execution policy from the overload set, which gives you better error messages and faster compilation.
Unfortunately, this proposal is quite large, and I don't know when I'll get around to dedicated time to it.
Reactions are currently unavailable
Sub-issues
Metadata
Metadata
Assignees
Labels
P3777new-proposalIdea/discussion for possible new proposalsIdea/discussion for possible new proposals
Projects
Status
In Progress