Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++20 status.

3154.Common andCommonReference have a common defect

Section: 18.4.6[concept.common]Status:C++20Submitter: Casey CarterOpened: 2018-08-10Last modified: 2021-02-25

Priority:0

View all otherissues in [concept.common].

View all issues withC++20 status.

Discussion:

The semantic requirements of bothCommon(18.4.6[concept.common]):

-2- LetC becommon_­type_­t<T, U>. Lett be afunction whose return type isT, and letu be a function whosereturn type isU.Common<T, U> is satisfied only if:

(2.1) —C(t()) equalsC(t()) if and only ift()is an equality-preserving expression (18.2[concepts.equality]).

(2.2) —C(u()) equalsC(u()) if and only ifu()is an equality-preserving expression (18.2[concepts.equality]).

and similarlyCommonReference ( [concept.commonreference]):

-2- LetC becommon_­reference_­t<T, U>. Lett bea function whose return type isT, and letu be a functionwhose return type isU.CommonReference<T, U> issatisfied only if:

(2.1) —C(t()) equalsC(t()) if and only ift()is an equality-preserving expression (18.2[concepts.equality]).

(2.2) —C(u()) equalsC(u()) if and only ifu()is an equality-preserving expression.

don't properly reflect the intended design that conversions to the common type /common reference type are identity-preserving: in other words, that convertingtwo values to the common type produces equal results if and only if the valueswere initially equal. The phrasing "C(E) equalsC(E) if and only ifE is an equality-preserving expression" is also clearlydefective regardless of the intended design: the assertion "E is notequality-preserving" does not imply that every evaluation ofE producesdifferent results.

[2018-08 Batavia Monday issue prioritization]

Priority set to 0, status to 'Tentatively Ready'

[2018-11, Adopted in San Diego]

Proposed resolution:

This wording is relative toN4762.

  1. Modify 18.4.5[concept.commonref] p2 as follows:

    -2- LetC becommon_­reference_­t<T, U>. Lettbe a function whose return type ist1 andt2 beequality-preserving expressions (18.2[concepts.equality]) such thatdecltype((t1)) anddecltype((t2)) are eachT,and letu be a function whose return type isu1andu2 be equality-preserving expressions such thatdecltype((u1)) anddecltype((u2)) are eachU.T andU modelCommonReference<T, U>is satisfied only if:

    (2.1) —C(t1()) equalsC(t2()) if and only ift1()equalst2, andis an equality-preserving expression (18.2[concepts.equality]).

    (2.2) —C(u1()) equalsC(u2()) if and only ifu1()equalsu2is an equality-preserving expression.

  2. Modify 18.4.6[concept.common] p2 similarly:

    -2- LetC becommon_­type_­t<T, U>. Lett bea function whose return type ist1 andt2 beequality-preserving expressions (18.2[concepts.equality]) such thatdecltype((t1)) anddecltype((t2)) are eachT,and letu be a function whose return type isu1andu2 be equality-preserving expressions such thatdecltype((u1)) anddecltype((u2)) are eachU.T andU modelCommon<T, U>issatisfied only if:

    (2.1) —C(t1()) equalsC(t2()) if and only ift1()equalst2, andis an equality-preserving expression (18.2[concepts.equality]).

    (2.2) —C(u1()) equalsC(u2()) if and only ifu1()equalsu2is an equality-preserving expression (18.2[concepts.equality]).


[8]ページ先頭

©2009-2026 Movatter.jp