776. Undescribed assign function of std::array

Section: 26.3.7 [array] Status: CD1 Submitter: Daniel Krügler Opened: 2008-01-20 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [array].

View all issues with CD1 status.

Discussion:

The class template array synopsis in 26.3.7 [array] p. 3 declares a member function

void assign(const T& u);

which's semantic is no-where described. Since this signature is not part of the container requirements, such a semantic cannot be derived by those.

I found only one reference to this function in the issue list, 588 where the question is raised:

what's the effect of calling assign(T&) on a zero-sized array?

which does not answer the basic question of this issue.

If this function shall be part of the std::array, it's probable semantic should correspond to that of boost::array, but of course such wording must be added.

Proposed resolution:

Just after the section [array.data] add the following new section:

23.2.1.5 array::fill [array.fill]

void fill(const T& u);

1: Effects: fill_n(begin(), N, u)

[N.B: I wonder, why class array does not have a "modifiers" section. If it had, then assign would naturally belong to it]

Change the synopsis in 26.3.7 [array]/3:

template <class T, size_t N>
struct array { 
  ...
  void assign fill(const T& u);
  ...

[ Bellevue: ]

Suggest substituting "fill" instead of "assign".

Set state to Review given substitution of "fill" for "assign".