summaryrefslogtreecommitdiff
path: root/boost/algorithm/cxx11/iota.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/algorithm/cxx11/iota.hpp')
-rw-r--r--boost/algorithm/cxx11/iota.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/boost/algorithm/cxx11/iota.hpp b/boost/algorithm/cxx11/iota.hpp
index b4f0dafa6d..eb32390b0f 100644
--- a/boost/algorithm/cxx11/iota.hpp
+++ b/boost/algorithm/cxx11/iota.hpp
@@ -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;
}