Title
tuple_element_t<1, const span<int, 42>> is const int
Status
resolved
Section
[span.tuple]
Submitter
Tim Song

Created on 2019-05-31.00:00:00 last changed 56 months ago

Messages

Date: 2020-05-01.19:14:16

Proposed resolution:

Resolved by P2116R0.

Date: 2020-05-15.00:00:00

[ 2020-05-01; reflector discussions ]

Resolved by P2116R0 voted in in Prague.

Date: 2020-02-15.00:00:00

[ 2020-02-14, Prague ]

Lengthy discussion about the intended design of span's tuple interface. Has been send to LEWG, who made several polls and concluded to remove the tuple interface for span for C++20.

Will be resolved by P2116R0.

Date: 2020-02-15.00:00:00

[ 2020-02-13, Prague ]

Wording needs to be adjusted, because we accepted P1831R1.

Previous resolution [SUPERSEDED]:

This wording is relative to N4849.

  1. Modify [span.syn], header <span> synopsis, as indicated:

    […]
    // [span.tuple], tuple interface
    template<class T> class tuple_size;
    template<size_t I, class T> class tuple_element;
    template<class ElementType, size_t Extent>
      struct tuple_size<span<ElementType, Extent>>;
    template<class ElementType>
      struct tuple_size<span<ElementType, dynamic_extent>>; // not defined
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, span<ElementType, Extent>>;
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, const span<ElementType, Extent>>;
    […]
    
  2. Modify [span.tuple] before p1 as indicated:

    template<class ElementType, size_t Extent>
      struct tuple_size<span<ElementType, Extent>>
        : integral_constant<size_t, Extent> { };
    
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, span<ElementType, Extent>> {
        using type = ElementType;
      };
    
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, const span<ElementType, Extent>> {
        using type = ElementType;
      };
    

    -1- Mandates: Extent != dynamic_extent && I < Extent is true.

  3. Add the following wording to Annex D:

    D.? Deprecated span tuple interface [depr.span.syn]

    1 The header <span> ([span.syn]) has the following additions:

    
    namespace std {
      template<size_t I, class ElementType, size_t Extent>
        struct tuple_element<I, volatile span<ElementType, Extent>>;
      template<size_t I, class ElementType, size_t Extent>
        struct tuple_element<I, const volatile span<ElementType, Extent>>;
    }
    

    D.1.? tuple interface [depr.span.tuple]

    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, volatile span<ElementType, Extent>> {
        using type = ElementType;
      };
    
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, const volatile span<ElementType, Extent>> {
        using type = ElementType;
      };
    

    -?- Mandates: Extent != dynamic_extent && I < Extent is true.

Date: 2020-02-13.12:25:23

As currently specified, it uses the cv-qualified partial specialization, which incorrectly adds cv-qualification to the element type.

Previous resolution [SUPERSEDED]:

This wording is relative to N4810.

  1. Modify [span.syn], header <span> synopsis, as indicated:

    […]
    // [span.tuple], tuple interface
    template<class T> class tuple_size;
    template<size_t I, class T> class tuple_element;
    template<class ElementType, size_t Extent>
      struct tuple_size<span<ElementType, Extent>>;
    template<class ElementType>
      struct tuple_size<span<ElementType, dynamic_extent>>; // not defined
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, span<ElementType, Extent>>;
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, const span<ElementType, Extent>>;
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, volatile span<ElementType, Extent>>;
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, const volatile span<ElementType, Extent>>;
    […]
    
  2. Modify [span.tuple] before p1 as indicated:

    [Drafting note: The representation style for the newly added wording follows the new style for tuple_element<I, span<ElementType, Extent>>::type, which had recently been changed editorially.]

    template<class ElementType, size_t Extent>
      struct tuple_size<span<ElementType, Extent>>
        : integral_constant<size_t, Extent> { };
    
    tuple_element<I, span<ElementType, Extent>>::type
    
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, const span<ElementType, Extent>> {
        using type = ElementType;
      };
    
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, volatile span<ElementType, Extent>> {
        using type = ElementType;
      };
    
    template<size_t I, class ElementType, size_t Extent>
      struct tuple_element<I, const volatile span<ElementType, Extent>> {
        using type = ElementType;
      };
    

    -1- Mandates: Extent != dynamic_extent && I < Extent is true.

History
Date User Action Args
2020-05-01 19:14:16adminsetmessages: + msg11251
2020-05-01 19:14:16adminsetmessages: + msg11250
2020-05-01 19:14:16adminsetstatus: new -> resolved
2020-02-13 12:25:23adminsetmessages: + msg11054
2019-06-08 16:31:03adminsetmessages: + msg10424
2019-05-31 00:00:00admincreate