OSDN Git Service

CUDA
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / cuda-6.5 / include / thrust / detail / tabulate.inl
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 #include <thrust/detail/config.h>
18 #include <thrust/tabulate.h>
19 #include <thrust/iterator/iterator_traits.h>
20 #include <thrust/system/detail/generic/select_system.h>
21 #include <thrust/system/detail/generic/tabulate.h>
22 #include <thrust/system/detail/adl/tabulate.h>
23
24 namespace thrust
25 {
26
27
28 template<typename DerivedPolicy, typename ForwardIterator, typename UnaryOperation>
29   void tabulate(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
30                 ForwardIterator first,
31                 ForwardIterator last,
32                 UnaryOperation unary_op)
33 {
34   using thrust::system::detail::generic::tabulate;
35   return tabulate(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, unary_op);
36 } // end tabulate()
37
38
39 template<typename ForwardIterator, typename UnaryOperation>
40   void tabulate(ForwardIterator first,
41                 ForwardIterator last,
42                 UnaryOperation unary_op)
43 {
44   using thrust::system::detail::generic::select_system;
45
46   typedef typename thrust::iterator_system<ForwardIterator>::type System;
47
48   System system;
49
50   return thrust::tabulate(select_system(system), first, last, unary_op);
51 } // end tabulate()
52
53
54 } // end namespace thrust
55