-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Ported from: microsoft/proxy#358
@frederick-vs-ja opened on Oct 20, 2025:
I wanted to open a PR for these but it seems that the proposal isn't open-sourced.
I've found some issues in the latest proposal for now (P3086R5).
- The term "trivial type" is deprecated by P3247R2. Instead of saying "
Xis a trivial type", perhaps we should say "is_trivially_copyable_v<X>andis_trivially_default_constructible_v<X>are bothtrue". - The "Constraints" element ([structure.specifications]/3.1) is not used.
- The "Require" element has been removed from [structure.specifications]. Given its only usage specifies conditions entirely detectible at compile time, it should be replaced with "Mandates".
- Given
constraint_levelis a scoped enumeration type, its underlying type is fixed and implicit specified asintper the current wording, and hence a value larger thanconstraint_level::trivialor less thanconstraint_level::none(e.g.constraint_level(127)orconstraint_level(-1)respectively) can be valid. Perhaps we don't want to accidently make such a value have valid effect.
E.g. I think it's clearer to specify the copy and move constructors as following.
proxy(const proxy& rhs) noexcept(F::copyability == constraint_level::trivial || F::copyability == constraint_level::nothrow);-?-. Effects: If
rhscontains a value of typeP, direct-non-list-initializes the contained value of the constructed object with aconst Plvalue that refers torhs’s contained value. Otherwise, constructs an emptyproxy.-?-. Remarks: This constructor is trivial if
F::copyability == constraint_level::trivialistrue, and deleted ifF::copyability == constraint_level::trivial,F::copyability == constraint_level::nothrow,F::copyability == constraint_level::nontrivialare allfalse.
[Drafting note: It is redundant to say a trivial copy constructor performs a bitwise copy.]
proxy(proxy&& rhs) noexcept(F::relocatability == constraint_level::nothrow);-?-. Constraints: Either
F::relocatability == constraint_level::nontrivialorF::copyability == constraint_level::nothrowistrue.-?-. Effects: If
rhscontains a value of typeP, moves its contained value into the constructed object (using either a move construction ofPor an implementation-defined trivial relocation when permitted by the constraint levels). Otherwise, constructs an empty proxy.-?-. Postconditions:
rhsdoes not contain a value.
@mingxwa on Oct 21, 2025:
Hi @frederick-vs-ja,
Thank you for reviewing P3086R5 and for providing concrete wording suggestions. Although the paper draft repository is not public, I will cite your feedback in the revision log of the next submission.
Points 1-3
Acknowledged. I will integrate those wording adjustments in the next revision.
Point 4 (enum class
constraint_level)
Rather than altering the enumeration, I plan to strengthen the facade-related requirements: each of F::copyability, F::relocatability, and F::destructibility must be exactly one of the four enumerators; otherwise facade<F> evaluates to false. This prevents a non-enumerator value from having effect without changing the enumeration definition.
Constructor wording follow-up
I will adapt your copy and move constructor templates using current specification structure and omit redundant remarks about trivial copying.
Thank you again for the careful review.