mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-05 16:56:39 +02:00
Rewrote iota_n to use pre-increment instead of post - now the same as iota. Added a test for 0 as well.
[SVN r85465]
This commit is contained in:
@ -63,8 +63,8 @@ void iota ( Range &r, T value )
|
||||
template <typename OutputIterator, typename T>
|
||||
OutputIterator iota_n ( OutputIterator out, T value, std::size_t n )
|
||||
{
|
||||
while ( n-- > 0 )
|
||||
*out++ = value++;
|
||||
for ( ; n > 0; --n, ++value )
|
||||
*out++ = value;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
Reference in New Issue
Block a user