Skip to content

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

@Dani-Hub

Description

@Dani-Hub

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions