File indexing completed on 2025-01-30 09:48:15
0001 #ifndef BOOST_MULTI_ARRAY_ALGORITHM_HPP
0002 #define BOOST_MULTI_ARRAY_ALGORITHM_HPP
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #include <iterator>
0044
0045 namespace boost {
0046 namespace detail {
0047 namespace multi_array {
0048
0049
0050 #if 1
0051
0052 template <class InputIter, class Size, class OutputIter>
0053 OutputIter copy_n(InputIter first, Size count,
0054 OutputIter result) {
0055 for ( ; count > 0; --count) {
0056 *result = *first;
0057 ++first;
0058 ++result;
0059 }
0060 return result;
0061 }
0062 #else
0063
0064 template <class InputIter, class Size, class OutputIter>
0065 OutputIter copy_n__(InputIter first, Size count,
0066 OutputIter result,
0067 std::input_iterator_tag) {
0068 for ( ; count > 0; --count) {
0069 *result = *first;
0070 ++first;
0071 ++result;
0072 }
0073 return result;
0074 }
0075
0076 template <class RAIter, class Size, class OutputIter>
0077 inline OutputIter
0078 copy_n__(RAIter first, Size count,
0079 OutputIter result,
0080 std::random_access_iterator_tag) {
0081 RAIter last = first + count;
0082 return std::copy(first, last, result);
0083 }
0084
0085 template <class InputIter, class Size, class OutputIter>
0086 inline OutputIter
0087 copy_n__(InputIter first, Size count, OutputIter result) {
0088 typedef typename std::iterator_traits<InputIter>::iterator_category cat;
0089 return copy_n__(first, count, result, cat());
0090 }
0091
0092 template <class InputIter, class Size, class OutputIter>
0093 inline OutputIter
0094 copy_n(InputIter first, Size count, OutputIter result) {
0095 return copy_n__(first, count, result);
0096 }
0097
0098 #endif
0099 }
0100 }
0101 }
0102
0103 #endif