3 // Copyright Neil Groves 2009. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/range/
10 #ifndef BOOST_RANGE_ALGORITHM_EXT_IOTA_HPP_INCLUDED
11 #define BOOST_RANGE_ALGORITHM_EXT_IOTA_HPP_INCLUDED
13 #include <boost/range/config.hpp>
14 #include <boost/range/concepts.hpp>
15 #include <boost/range/iterator.hpp>
16 #include <boost/range/begin.hpp>
17 #include <boost/range/end.hpp>
24 template< class ForwardRange, class Value >
25 inline ForwardRange& iota( ForwardRange& rng, Value x )
27 BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
28 typedef BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type iterator_t;
30 iterator_t last_target = ::boost::end(rng);
31 for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x)
37 template< class ForwardRange, class Value >
38 inline const ForwardRange& iota( const ForwardRange& rng, Value x )
40 BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
41 typedef BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type iterator_t;
43 iterator_t last_target = ::boost::end(rng);
44 for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x)
54 #endif // include guard