Skip to content

US 10-023 5.11, 11.01, 11.2, A.9, C.1.4, C.1.6 Remove *_if_eligible keywords #597

@wg21bot

Description

@wg21bot

The new identifiers with special meaning "trivially_relocatable_if_eligible" and "replaceable_if_eligible" are embarrassingly verbose. They are too long for practical use.

They will not see use in industry because their semantics do not match the semantics requested by over a dozen industry veterans representing seven major projects (Amadeus, Blender, Boost, Parlay, Folly, Qt, HPX) across P3233, P3236, P1144R13, P3780, etc.

Compiler vendors will have to add a __keyword or [[attribute]] anyway, to permit their library vendor to optimize types like unique_ptr in pre-C++26 modes. Library vendors cannot use the new identifiers with special meaning outside of C++26 mode.

Even in C++26 mode, a compiler-specific "opt-in" (P1144-style) attribute or keyword may be needed in order to support constexpr optional and inplace_vector, for which the P2786-style warrant is insufficient.
The new identifiers as such are useful only for user-defined resource-management classes, in C++26-only codebases. (Rule-of-Zero classes do not need them. C++23 codebases must use a vendor-specific mechanism such as an attribute.) This is a very small fraction of a small fraction: permitting this syntax gains very little in performance, but loses much in confusion to the industry and embarrassment to the community.

For all these reasons these identifiers should be removed from C++26, and their design reconsidered for C++29 after there has been any implementation and usage experience. We can safely remove these identifiers with special meaning, without at all harming the library feature of "relocation" itself.

Proposed change:Adopt P3823 R0 "Wording for US NB comment 10".

Alternatively, adopting all of P1144 R13 "std::is_trivially_relocatable" would moot this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions