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

[swappable.requirements] Consider to introduce Cpp17Swappable requirements as new editorial convenience requirement #5628

Closed
Dani-Hub opened this issue Jul 17, 2022 · 3 comments · Fixed by #5978

Comments

@Dani-Hub
Copy link
Member

Dani-Hub commented Jul 17, 2022

The by far most often used "swappable" requirement used in the current normative wording has the style

lvalues of type T are swappable

defined in [swappable.requirements]. This is rather lengthy wording for a simple thing, and has caused editorial hiccups such as the one mentioned in #5627. I suggest introducing a new editorial vocabulary, Cpp17Swappable to be introduced in subclause [swappable.requirements], for example as follows:

A type X meets the Cpp17Swappable requirements if lvalues of type X are swappable.

just before line 5 defining the Cpp17ValueSwappable requirements and to replace using existing wording of the above mentioned form "lvalues of type T are swappable" by "T meets the Cpp17Swappable requirements".

This approach would be similar to the style used for other Cpp17 requirements and can be easily migrated into a collection of such requirements. For example, both bullets (5.1) and (5.2) of [unord.hash] could easily be merged into a single bullet of the form:

meet the Cpp17Hash requirements (Table 36), with Key as the function call argument type, the
Cpp17DefaultConstructible requirements (Table 29), the Cpp17CopyAssignable requirements (Table 33), the Cpp17Swappable requirements ([swappable.requirements]),

A similar and by far not last example is the potential merge of formatter.requirements] bullet (1.2) into the (1.1.x) sub-bullets, etc.

This particular wording form also matches quite well with syntactic requirements such as is_swappable_v versus the most general form is_swappable_with_v.

If this suggestion goes beyond an editorial action, please let me know, whether instead an official paper proposal would be preferred to realize these effects.

@Dani-Hub
Copy link
Member Author

I have decided to provide an official proposal to realize these effects. I would appreciate if we could keep the issue open until I have added a reference to the provided proposal (assuming this happens within an acceptable time frame).

@Dani-Hub
Copy link
Member Author

A paper exists now, D2696R0, so feel free to close this issue now.

@Dani-Hub
Copy link
Member Author

Dani-Hub commented Nov 5, 2022

The paper has been published now: P2696R0.

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 a pull request may close this issue.

1 participant