Created on 2008-07-13.00:00:00 last changed 162 months ago
Proposed resolution:
Replace the current declaration of fill_n in [algorithms]/2, header <algorithm> synopsis and in [alg.fill] by
template<class OutputIterator, class Size, class T>voidOutputIterator fill_n(OutputIterator first, Size n, const T& value);
Just after the effects clause add a new returns clause saying:
Returns: For fill_n and positive n, returns first + n. Otherwise returns first for fill_n.
Replace the current declaration of generate_n in [algorithms]/2, header <algorithm> synopsis and in [alg.generate] by
template<class OutputIterator, class Size, class Generator>voidOutputIterator generate_n(OutputIterator first, Size n, Generator gen);
Just after the effects clause add a new returns clause saying:
For generate_n and positive n, returns first + n. Otherwise returns first for generate_n.
[ 2009-10 Santa Cruz: ]
Moved to Ready.
[ 2009-07-25 Daniel provided non-concepts wording. ]
[ 2009-07 Frankfurt ]
We have a consensus for moving forward on this issue, but Daniel needs to deconceptify it.
[ Batavia (2009-05): ]
Alisdair likes the idea, but has concerns about the specific wording about the returns clauses.
Alan notes this is a feature request.
Bill notes we have made similar changes to other algorithms.
Move to Open.
[ Post Summit Daniel "conceptualized" the wording. ]
In regard to library defect 488 I found some more algorithms which unnecessarily throw away information. These are typically algorithms, which sequentially write into an OutputIterator, but do not return the final value of this output iterator. These cases are:
template<class OutputIterator, class Size, class T> void fill_n(OutputIterator first, Size n, const T& value);
template<class OutputIterator, class Size, class Generator> void generate_n(OutputIterator first, Size n, Generator gen);
In both cases the minimum requirements on the iterator are OutputIterator, which means according to the requirements of [output.iterators] p. 2 that only single-pass iterations are guaranteed. So, if users of fill_n and generate_n have only an OutputIterator available, they have no chance to continue pushing further values into it, which seems to be a severe limitation to me.
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-08-23 20:07:26 | admin | set | status: wp -> c++11 |
2010-10-21 18:28:33 | admin | set | messages: + msg4117 |
2010-10-21 18:28:33 | admin | set | messages: + msg4116 |
2010-10-21 18:28:33 | admin | set | messages: + msg4115 |
2010-10-21 18:28:33 | admin | set | messages: + msg4114 |
2010-10-21 18:28:33 | admin | set | messages: + msg4113 |
2010-10-21 18:28:33 | admin | set | messages: + msg4112 |
2008-07-13 00:00:00 | admin | create |