123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef BOOST_ALGORITHM_IOTA_HPP
- #define BOOST_ALGORITHM_IOTA_HPP
- #include <numeric>
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- namespace boost { namespace algorithm {
- template <typename ForwardIterator, typename T>
- void iota ( ForwardIterator first, ForwardIterator last, T value )
- {
- for ( ; first != last; ++first, ++value )
- *first = value;
- }
- template <typename Range, typename T>
- void iota ( Range &r, T value )
- {
- boost::algorithm::iota (boost::begin(r), boost::end(r), value);
- }
- template <typename OutputIterator, typename T>
- OutputIterator iota_n ( OutputIterator out, T value, std::size_t n )
- {
- for ( ; n > 0; --n, ++value )
- *out++ = value;
- return out;
- }
- }}
- #endif
|