1 #ifndef BOOST_ALGORITHM_RG071801_HPP
2 #define BOOST_ALGORITHM_RG071801_HPP
7 // Hewlett-Packard Company
9 // Permission to use, copy, modify, distribute and sell this software
10 // and its documentation for any purpose is hereby granted without fee,
11 // provided that the above copyright notice appear in all copies and
12 // that both that copyright notice and this permission notice appear
13 // in supporting documentation. Hewlett-Packard Company makes no
14 // representations about the suitability of this software for any
15 // purpose. It is provided "as is" without express or implied warranty.
18 // Copyright (c) 1996-1998
19 // Silicon Graphics Computer Systems, Inc.
21 // Permission to use, copy, modify, distribute and sell this software
22 // and its documentation for any purpose is hereby granted without fee,
23 // provided that the above copyright notice appear in all copies and
24 // that both that copyright notice and this permission notice appear
25 // in supporting documentation. Silicon Graphics makes no
26 // representations about the suitability of this software for any
27 // purpose. It is provided "as is" without express or implied warranty.
30 // Copyright 2002 The Trustees of Indiana University.
32 // Use, modification and distribution is subject to the Boost Software
33 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
34 // http://www.boost.org/LICENSE_1_0.txt)
36 // Boost.MultiArray Library
37 // Authors: Ronald Garcia
40 // See http://www.boost.org/libs/multi_array for documentation.
43 #include "boost/iterator.hpp"
47 //--------------------------------------------------
48 // copy_n (not part of the C++ standard)
51 template <class InputIter, class Size, class OutputIter>
52 OutputIter copy_n(InputIter first, Size count,
54 for ( ; count > 0; --count) {
63 template <class InputIter, class Size, class OutputIter>
64 OutputIter copy_n__(InputIter first, Size count,
66 std::input_iterator_tag) {
67 for ( ; count > 0; --count) {
75 template <class RAIter, class Size, class OutputIter>
77 copy_n__(RAIter first, Size count,
79 std::random_access_iterator_tag) {
80 RAIter last = first + count;
81 return std::copy(first, last, result);
84 template <class InputIter, class Size, class OutputIter>
86 copy_n__(InputIter first, Size count, OutputIter result) {
87 typedef typename std::iterator_traits<InputIter>::iterator_category cat;
88 return copy_n__(first, count, result, cat());
91 template <class InputIter, class Size, class OutputIter>
93 copy_n(InputIter first, Size count, OutputIter result) {
94 return copy_n__(first, count, result);
101 #endif // BOOST_ALGORITHM_RG071801_HPP