2 * Copyright 2008-2013 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.
17 #include <thrust/detail/config.h>
18 #include <thrust/detail/type_traits/pointer_traits.h>
19 #include <thrust/system/detail/generic/memory.h>
20 #include <thrust/system/detail/generic/select_system.h>
21 #include <thrust/system/detail/adl/malloc_and_free.h>
22 #include <thrust/detail/static_assert.h>
23 #include <thrust/detail/malloc_and_free.h>
35 template<typename DerivedPolicy, typename Size>
36 void malloc(thrust::execution_policy<DerivedPolicy> &, Size)
39 THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Size, false>::value) );
43 template<typename T, typename DerivedPolicy>
44 thrust::pointer<T,DerivedPolicy>
45 malloc(thrust::execution_policy<DerivedPolicy> &exec, std::size_t n)
47 thrust::pointer<void,DerivedPolicy> void_ptr = thrust::malloc(exec, sizeof(T) * n);
49 return pointer<T,DerivedPolicy>(static_cast<T*>(void_ptr.get()));
53 template<typename DerivedPolicy, typename Pointer>
54 void free(thrust::execution_policy<DerivedPolicy> &, Pointer)
57 THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Pointer, false>::value) );
61 template<typename DerivedPolicy, typename Pointer1, typename Pointer2>
63 void assign_value(thrust::execution_policy<DerivedPolicy> &, Pointer1, Pointer2)
66 THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Pointer1, false>::value) );
70 template<typename DerivedPolicy, typename Pointer>
72 void get_value(thrust::execution_policy<DerivedPolicy> &, Pointer)
75 THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Pointer, false>::value) );
79 template<typename Pointer1, typename Pointer2>
81 void iter_swap(tag, Pointer1, Pointer2)
84 THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Pointer1, false>::value) );