Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:22

0001 /* 
0002    Copyright (c) Marshall Clow 2011-2012.
0003 
0004    Distributed under the Boost Software License, Version 1.0. (See accompanying
0005    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 */
0007 
0008 /// \file  copy_n.hpp
0009 /// \brief Copy n items from one sequence to another
0010 /// \author Marshall Clow
0011 
0012 #ifndef BOOST_ALGORITHM_COPY_N_HPP
0013 #define BOOST_ALGORITHM_COPY_N_HPP
0014 
0015 #include <boost/config.hpp>
0016 
0017 namespace boost { namespace algorithm {
0018 
0019 /// \fn copy_n ( InputIterator first, Size n, OutputIterator result )
0020 /// \brief Copies exactly n (n > 0) elements from the range starting at first to
0021 ///     the range starting at result.
0022 /// \return         The updated output iterator
0023 /// 
0024 /// \param first    The start of the input sequence
0025 /// \param n        The number of elements to copy
0026 /// \param result   An output iterator to write the results into
0027 /// \note           This function is part of the C++2011 standard library.
0028 template <typename InputIterator, typename Size, typename OutputIterator>
0029 BOOST_CXX14_CONSTEXPR OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result )
0030 {
0031     for ( ; n > 0; --n, ++first, ++result )
0032         *result = *first;
0033     return result;
0034 }
0035 }} // namespace boost and algorithm
0036 
0037 #endif  // BOOST_ALGORITHM_COPY_IF_HPP