std::array
Section: 23.3.3.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:
23.3.3.1 [array.overview] shows std::array
with an "exposition only" data member, elems
.
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 23.3.3.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.
Edit 23.3.3.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 variableelems
is shown for exposition only, to emphasize that array is a class aggregate. The nameelems
is not part of array's interface. — end note]
Edit [array.data] as follows:
constexpr T* data() noexcept; constexpr const T* data() const noexcept;-1- Returns:
A pointer such thatelems
[data(), data() + size())
is a valid range, anddata() == addressof(front())
.