File indexing completed on 2025-01-18 09:51:15
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_RANGE_ALGORITHM_COPY_N_HPP_INCLUDED
0010 #define BOOST_RANGE_ALGORITHM_COPY_N_HPP_INCLUDED
0011
0012 #include <boost/assert.hpp>
0013 #include <boost/concept_check.hpp>
0014 #include <boost/range/begin.hpp>
0015 #include <boost/range/end.hpp>
0016 #include <boost/range/concepts.hpp>
0017 #include <boost/range/distance.hpp>
0018 #include <boost/range/iterator.hpp>
0019 #include <boost/range/iterator_range.hpp>
0020 #include <algorithm>
0021
0022 namespace boost
0023 {
0024 namespace range
0025 {
0026
0027
0028
0029
0030
0031
0032
0033
0034 template< class SinglePassRange, class Size, class OutputIterator >
0035 inline OutputIterator copy_n(const SinglePassRange& rng, Size n, OutputIterator out)
0036 {
0037 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
0038 BOOST_ASSERT( n <= static_cast<Size>(::boost::distance(rng)) );
0039 BOOST_ASSERT( n >= static_cast<Size>(0) );
0040
0041 BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange>::type source = ::boost::begin(rng);
0042
0043 for (Size i = 0; i < n; ++i, ++out, ++source)
0044 *out = *source;
0045
0046 return out;
0047 }
0048
0049 }
0050 using ::boost::range::copy_n;
0051 }
0052
0053 #endif