This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

3182. Specification of Same could be clearer

Section: 18.4.2 [concept.same] Status: WP Submitter: Casey Carter Opened: 2019-01-05 Last modified: 2019-02-27

Priority: 0

View all issues with WP status.

Discussion:

The specification of the Same concept in 18.4.2 [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.

[2019-01-20 Reflector prioritization]

Set Priority to and status to Tentatively Ready

Proposed resolution:

This wording is relative to N4791.

  1. Change 18.4.2 [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]