Chris@16: #ifndef BOOST_ALGORITHM_RG071801_HPP Chris@16: #define BOOST_ALGORITHM_RG071801_HPP Chris@16: Chris@16: // Chris@16: // Chris@16: // Copyright (c) 1994 Chris@16: // Hewlett-Packard Company Chris@16: // Chris@16: // Permission to use, copy, modify, distribute and sell this software Chris@16: // and its documentation for any purpose is hereby granted without fee, Chris@16: // provided that the above copyright notice appear in all copies and Chris@16: // that both that copyright notice and this permission notice appear Chris@16: // in supporting documentation. Hewlett-Packard Company makes no Chris@16: // representations about the suitability of this software for any Chris@16: // purpose. It is provided "as is" without express or implied warranty. Chris@16: // Chris@16: // Chris@16: // Copyright (c) 1996-1998 Chris@16: // Silicon Graphics Computer Systems, Inc. Chris@16: // Chris@16: // Permission to use, copy, modify, distribute and sell this software Chris@16: // and its documentation for any purpose is hereby granted without fee, Chris@16: // provided that the above copyright notice appear in all copies and Chris@16: // that both that copyright notice and this permission notice appear Chris@16: // in supporting documentation. Silicon Graphics makes no Chris@16: // representations about the suitability of this software for any Chris@16: // purpose. It is provided "as is" without express or implied warranty. Chris@16: // Chris@16: Chris@16: // Copyright 2002 The Trustees of Indiana University. Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // Boost.MultiArray Library Chris@16: // Authors: Ronald Garcia Chris@16: // Jeremy Siek Chris@16: // Andrew Lumsdaine Chris@16: // See http://www.boost.org/libs/multi_array for documentation. Chris@16: Chris@16: Chris@16: #include "boost/iterator.hpp" Chris@16: Chris@16: namespace boost { Chris@16: namespace detail { Chris@16: namespace multi_array { Chris@16: //-------------------------------------------------- Chris@16: // copy_n (not part of the C++ standard) Chris@16: #if 1 Chris@16: Chris@16: template Chris@16: OutputIter copy_n(InputIter first, Size count, Chris@16: OutputIter result) { Chris@16: for ( ; count > 0; --count) { Chris@16: *result = *first; Chris@16: ++first; Chris@16: ++result; Chris@16: } Chris@16: return result; Chris@16: } Chris@16: #else // !1 Chris@16: Chris@16: template Chris@16: OutputIter copy_n__(InputIter first, Size count, Chris@16: OutputIter result, Chris@16: std::input_iterator_tag) { Chris@16: for ( ; count > 0; --count) { Chris@16: *result = *first; Chris@16: ++first; Chris@16: ++result; Chris@16: } Chris@16: return result; Chris@16: } Chris@16: Chris@16: template Chris@16: inline OutputIter Chris@16: copy_n__(RAIter first, Size count, Chris@16: OutputIter result, Chris@16: std::random_access_iterator_tag) { Chris@16: RAIter last = first + count; Chris@16: return std::copy(first, last, result); Chris@16: } Chris@16: Chris@16: template Chris@16: inline OutputIter Chris@16: copy_n__(InputIter first, Size count, OutputIter result) { Chris@16: typedef typename std::iterator_traits::iterator_category cat; Chris@16: return copy_n__(first, count, result, cat()); Chris@16: } Chris@16: Chris@16: template Chris@16: inline OutputIter Chris@16: copy_n(InputIter first, Size count, OutputIter result) { Chris@16: return copy_n__(first, count, result); Chris@16: } Chris@16: Chris@16: #endif // 1 Chris@16: } // namespace multi_array Chris@16: } // namespace detail Chris@16: } // namespace boost Chris@16: Chris@16: #endif // BOOST_ALGORITHM_RG071801_HPP