Title
Public exposition only member in std::array
Status
c++17
Section
[array.overview]
Submitter
Jonathan Wakely

Created on 2013-09-30.00:00:00 last changed 81 months ago

Messages

Date: 2016-06-05.18:54:15

Proposed resolution:

This wording is relative to N4582.

  1. Edit [array.overview] as indicated

    […]

    -3- An array […]

    namespace std {
      template <class T, size_t N>
      struct array {
        […]
        T elems[N]; // exposition only
        […]
      };
    }
    

    -4- [Note: The member variable elems is shown for exposition only, to emphasize that array is a class aggregate. The name elems is not part of array's interface. — end note]

  2. Edit [array.data] as follows:

    constexpr T* data() noexcept;
    constexpr const T* data() const noexcept;
    

    -1- Returns: elemsA pointer such that [data(), data() + size()) is a valid range, and data() == addressof(front()).

Date: 2016-03-07.05:48:12
Move to Ready.

[ 2016-03 Jacksonville ]

Move to Ready.
Date: 2016-02-15.00:00:00

[ 2016-02-04, Tim Song improves the P/R ]

Instead of the build-in address-operator, std::addressof should be used.

Date: 2015-11-15.00:00:00

[ 2015-11-14, Geoffrey Romer provides wording ]

Date: 2015-11-04.16:49:21

[ Kona 2015-10: Link to 2516 ]

Date: 2014-11-08.16:43:57

[ Urbana 2014-11-07: Move to Open ]

Date: 2013-09-30.00:00:00

[array.overview] shows std::array with an "exposition only" data member, elems.

The wording in [objects.within.classes] that defines how "exposition only" is used says it applies to private members, but std::array::elems (or its equivalent) must be public in order for std::array to be an aggregate.

If the intention is that std::array::elems places requirements on the implementation to provide "equivalent external behavior" to a public array member, then [objects.within.classes] needs to cover public members too, or some other form should be used in [array.overview].

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-06-28 12:47:21adminsetstatus: ready -> wp
2016-03-07 05:48:12adminsetmessages: + msg8008
2016-03-07 05:48:12adminsetstatus: review -> ready
2016-02-04 16:46:21adminsetmessages: + msg7954
2015-12-11 20:55:37adminsetstatus: open -> review
2015-12-10 21:33:58adminsetmessages: + msg7640
2015-12-10 21:33:58adminsetmessages: + msg7639
2015-11-04 16:49:21adminsetmessages: + msg7601
2014-11-08 16:43:57adminsetmessages: + msg7171
2014-11-08 16:43:57adminsetstatus: new -> open
2013-09-30 00:00:00admincreate