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

### 2310. Public exposition only member in `std::array`

Section: 22.3.7.1 [array.overview] Status: C++17 Submitter: Jonathan Wakely Opened: 2013-09-30 Last modified: 2017-07-30

Priority: 4

View other active issues in [array.overview].

View all other issues in [array.overview].

View all issues with C++17 status.

Discussion:

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

The wording in 16.3.3.5 [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 16.3.3.5 [objects.within.classes] needs to cover public members too, or some other form should be used in 22.3.7.1 [array.overview].

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

[Kona 2015-10: Link to 2516]

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

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

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

[2016-03 Jacksonville]

Move to Ready.

Proposed resolution:

This wording is relative to N4582.

1. Edit 22.3.7.1 [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: `elems` A pointer such that `[data(), data() + size())` is a valid range, and `data() == addressof(front())`.