OSDN Git Service

CUDA
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / cuda-6.5 / include / thrust / system / detail / internal / scalar / general_copy.h
1 /*
2  *  Copyright 2008-2013 NVIDIA Corporation
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  */
16
17 /*! \file general_copy.h
18  *  \brief Sequential copy algorithms for general iterators.
19  */
20
21 #pragma once
22
23 #include <thrust/detail/config.h>
24
25 namespace thrust
26 {
27 namespace system
28 {
29 namespace detail
30 {
31 namespace internal
32 {
33 namespace scalar
34 {
35
36 template<typename InputIterator,
37          typename OutputIterator>
38   OutputIterator general_copy(InputIterator first,
39                               InputIterator last,
40                               OutputIterator result)
41 {
42   for(; first != last; ++first, ++result)
43     *result = *first;
44   return result;
45 } // end general_copy()
46
47
48 template<typename InputIterator,
49          typename Size,
50          typename OutputIterator>
51   OutputIterator general_copy_n(InputIterator first,
52                                 Size n,
53                                 OutputIterator result)
54 {
55   for(; n > Size(0); ++first, ++result, --n)
56     *result = *first;
57   return result;
58 } // end general_copy_n()
59
60 } // end namespace scalar
61 } // end namespace internal
62 } // end namespace detail
63 } // end namespace system
64 } // end namespace thrust
65