Back to home page

EIC code displayed by LXR

 
 

    


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 // Copyright (c) 1994
0007 // Hewlett-Packard Company
0008 //
0009 // Permission to use, copy, modify, distribute and sell this software
0010 // and its documentation for any purpose is hereby granted without fee,
0011 // provided that the above copyright notice appear in all copies and
0012 // that both that copyright notice and this permission notice appear
0013 // in supporting documentation.  Hewlett-Packard Company makes no
0014 // representations about the suitability of this software for any
0015 // purpose.  It is provided "as is" without express or implied warranty.
0016 //
0017 //
0018 // Copyright (c) 1996-1998
0019 // Silicon Graphics Computer Systems, Inc.
0020 //
0021 // Permission to use, copy, modify, distribute and sell this software
0022 // and its documentation for any purpose is hereby granted without fee,
0023 // provided that the above copyright notice appear in all copies and
0024 // that both that copyright notice and this permission notice appear
0025 // in supporting documentation.  Silicon Graphics makes no
0026 // representations about the suitability of this software for any
0027 // purpose.  It is provided "as is" without express or implied warranty.
0028 //
0029 
0030 // Copyright 2002 The Trustees of Indiana University.
0031 
0032 // Use, modification and distribution is subject to the Boost Software 
0033 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0034 // http://www.boost.org/LICENSE_1_0.txt)
0035 
0036 //  Boost.MultiArray Library
0037 //  Authors: Ronald Garcia
0038 //           Jeremy Siek
0039 //           Andrew Lumsdaine
0040 //  See http://www.boost.org/libs/multi_array for documentation.
0041 
0042 
0043 #include <iterator>
0044 
0045 namespace boost {
0046 namespace detail {
0047 namespace multi_array {
0048 //--------------------------------------------------
0049 // copy_n (not part of the C++ standard)
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 // !1
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 // 1
0099 } // namespace multi_array
0100 } // namespace detail
0101 } // namespace boost
0102 
0103 #endif