2 * Copyright 2008-2012 NVIDIA Corporation
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * \brief Inline file for fill.h.
22 #include <thrust/fill.h>
23 #include <thrust/iterator/iterator_traits.h>
24 #include <thrust/system/detail/generic/select_system.h>
25 #include <thrust/system/detail/generic/fill.h>
26 #include <thrust/system/detail/adl/fill.h>
32 template<typename DerivedPolicy, typename ForwardIterator, typename T>
33 void fill(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
34 ForwardIterator first,
38 using thrust::system::detail::generic::fill;
39 return fill(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, value);
43 template<typename DerivedPolicy, typename OutputIterator, typename Size, typename T>
44 OutputIterator fill_n(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
49 using thrust::system::detail::generic::fill_n;
50 return fill_n(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, n, value);
54 template<typename ForwardIterator, typename T>
55 void fill(ForwardIterator first,
59 using thrust::system::detail::generic::select_system;
61 typedef typename thrust::iterator_system<ForwardIterator>::type System;
65 thrust::fill(select_system(system), first, last, value);
69 template<typename OutputIterator, typename Size, typename T>
70 OutputIterator fill_n(OutputIterator first,
74 using thrust::system::detail::generic::select_system;
76 typedef typename thrust::iterator_system<OutputIterator>::type System;
80 return thrust::fill_n(select_system(system), first, n, value);
84 } // end namespace thrust