Title
Specification of Same could be clearer
Status
c++20
Section
[concept.same]
Submitter
Casey Carter

Created on 2019-01-05.00:00:00 last changed 46 months ago

Messages

Date: 2019-01-20.16:20:00

Proposed resolution:

This wording is relative to N4791.

  1. Change [concept.same] as follows:

    template<class T, class U>
      concept same-impl = // exposition only
        is_same_v<T, U>;
    
    template<class T, class U>
      concept Same = is_same_v<T, U>same-impl<T, U> && same-impl<U, T>;
    

    -1- [Note: Same<T, U> subsumes Same<U, T> and vice versa.end note]

Date: 2019-01-20.00:00:00

[ 2019-01-20 Reflector prioritization ]

Set Priority to and status to Tentatively Ready

Date: 2019-01-05.00:00:00

The specification of the Same concept in [concept.same]:

template<class T, class U>
  concept Same = is_same_v<T, U>;

-1- Same<T, U> subsumes Same<U, T> and vice versa.

seems contradictory. From the concept definition alone, it is not the case that Same<T, U> subsumes Same<U, T> nor vice versa. Paragraph 1 is trying to tell us that there's some magic that provides the stated subsumption relationship, but to a casual reader it appears to be a mis-annotated note. We should either add a note to explain what's actually happening here, or define the concept in such a way that it naturally provides the specified subsumption relationship.

Given that there's a straightforward library implementation of the symmetric subsumption idiom, the latter option seems preferable.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2019-02-26 17:40:23adminsetstatus: voting -> wp
2019-01-21 04:50:04adminsetstatus: ready -> voting
2019-01-20 16:20:00adminsetmessages: + msg10294
2019-01-20 16:20:00adminsetstatus: new -> ready
2019-01-05 19:14:04adminsetmessages: + msg10276
2019-01-05 00:00:00admincreate