]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/algorithm/cxx11/copy_n.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / algorithm / cxx11 / copy_n.hpp
CommitLineData
7c673cae
FG
1/*
2 Copyright (c) Marshall Clow 2011-2012.
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6*/
7
8/// \file copy_n.hpp
9/// \brief Copy n items from one sequence to another
10/// \author Marshall Clow
11
12#ifndef BOOST_ALGORITHM_COPY_N_HPP
13#define BOOST_ALGORITHM_COPY_N_HPP
14
92f5a8d4
TL
15#include <boost/config.hpp>
16
7c673cae
FG
17namespace boost { namespace algorithm {
18
19/// \fn copy_n ( InputIterator first, Size n, OutputIterator result )
20/// \brief Copies exactly n (n > 0) elements from the range starting at first to
21/// the range starting at result.
22/// \return The updated output iterator
23///
24/// \param first The start of the input sequence
25/// \param n The number of elements to copy
26/// \param result An output iterator to write the results into
27/// \note This function is part of the C++2011 standard library.
28template <typename InputIterator, typename Size, typename OutputIterator>
92f5a8d4 29BOOST_CXX14_CONSTEXPR OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result )
7c673cae
FG
30{
31 for ( ; n > 0; --n, ++first, ++result )
32 *result = *first;
33 return result;
34}
35}} // namespace boost and algorithm
36
37#endif // BOOST_ALGORITHM_COPY_IF_HPP