Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:15

0001 // Boost.Range library
0002 //
0003 //  Copyright Neil Groves 2009. Use, modification and
0004 //  distribution is subject to the Boost Software License, Version
0005 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // For more information, see http://www.boost.org/libs/range/
0009 //
0010 #ifndef BOOST_RANGE_ALGORITHM_EXT_IOTA_HPP_INCLUDED
0011 #define BOOST_RANGE_ALGORITHM_EXT_IOTA_HPP_INCLUDED
0012 
0013 #include <boost/range/config.hpp>
0014 #include <boost/range/concepts.hpp>
0015 #include <boost/range/iterator.hpp>
0016 #include <boost/range/begin.hpp>
0017 #include <boost/range/end.hpp>
0018 
0019 namespace boost
0020 {
0021     namespace range
0022     {
0023 
0024 template< class ForwardRange, class Value >
0025 inline ForwardRange& iota( ForwardRange& rng, Value x )
0026 {
0027     BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
0028     typedef BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type iterator_t;
0029 
0030     iterator_t last_target = ::boost::end(rng);
0031     for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x)
0032         *target = x;
0033 
0034     return rng;
0035 }
0036 
0037 template< class ForwardRange, class Value >
0038 inline const ForwardRange& iota( const ForwardRange& rng, Value x )
0039 {
0040     BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
0041     typedef BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type iterator_t;
0042     
0043     iterator_t last_target = ::boost::end(rng);
0044     for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x)
0045         *target = x;
0046     
0047     return rng;
0048 }
0049 
0050     } // namespace range
0051     using range::iota;
0052 } // namespace boost
0053 
0054 #endif // include guard