871. Iota's requirements on T are too strong

Section: 29.8.12 [numeric.iota] Status: C++11 Submitter: Daniel Krügler Opened: 2008-08-20 Last modified: 2016-02-10

Priority: Not Prioritized

View all issues with C++11 status.

Discussion:

According to the recent WP N2691, 29.8.12 [numeric.iota]/1, the requires clause of std::iota says:

T shall meet the requirements of CopyConstructible and Assignable types, and shall be convertible to ForwardIterator's value type.[..]

Neither CopyConstructible nor Assignable is needed, instead MoveConstructible seems to be the correct choice. I guess the current wording resulted as an artifact from comparing it with similar numerical algorithms like accumulate.

Note: If this function will be conceptualized, the here proposed MoveConstructible requirement can be removed, because this is an implied requirement of function arguments, see N2710/[temp.req.impl]/3, last bullet.

[ post San Francisco: ]

Issue pulled by author prior to review.

[ 2009-07-30 Daniel reopened: ]

with the absence of concepts, this issue (closed) is valid again and I suggest to reopen it. I also revised by proposed resolution based on N2723 wording:

[ 2009-10 Santa Cruz: ]

Change 'convertible' to 'assignable', Move To Ready.

Proposed resolution:

Change the first sentence of 29.8.12 [numeric.iota]/1:

Requires: T shall meet the requirements of CopyConstructible and Assignable types, and shall be assignable to ForwardIterator's value type. [..]