OSDN Git Service

CUDA
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / cuda-6.5 / include / thrust / detail / allocator / tagged_allocator.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/detail/allocator/tagged_allocator.h>
19 #include <limits>
20
21 namespace thrust
22 {
23 namespace detail
24 {
25
26
27 template<typename T, typename Tag, typename Pointer>
28   tagged_allocator<T,Tag,Pointer>
29     ::tagged_allocator()
30 {}
31
32
33 template<typename T, typename Tag, typename Pointer>
34   tagged_allocator<T,Tag,Pointer>
35     ::tagged_allocator(const tagged_allocator<T,Tag,Pointer> &)
36 {}
37
38
39 template<typename T, typename Tag, typename Pointer>
40   template<typename U, typename OtherPointer>
41     tagged_allocator<T,Tag,Pointer>
42       ::tagged_allocator(const tagged_allocator<U,Tag,OtherPointer> &)
43 {}
44
45
46 template<typename T, typename Tag, typename Pointer>
47   tagged_allocator<T,Tag,Pointer>
48     ::~tagged_allocator()
49 {}
50
51
52 template<typename T, typename Tag, typename Pointer>
53   typename tagged_allocator<T,Tag,Pointer>::pointer
54     tagged_allocator<T,Tag,Pointer>
55       ::address(reference x) const
56 {
57   return &x;
58 }
59
60
61 template<typename T, typename Tag, typename Pointer>
62   typename tagged_allocator<T,Tag,Pointer>::const_pointer
63     tagged_allocator<T,Tag,Pointer>
64       ::address(const_reference x) const
65 {
66   return &x;
67 }
68
69
70 template<typename T, typename Tag, typename Pointer>
71   typename tagged_allocator<T,Tag,Pointer>::size_type
72     tagged_allocator<T,Tag,Pointer>
73       ::max_size() const
74 {
75   return (std::numeric_limits<size_type>::max)() / sizeof(T);
76 }
77
78
79 template<typename T1, typename Pointer1, typename T2, typename Pointer2, typename Tag>
80 __host__ __device__
81 bool operator==(const tagged_allocator<T1,Pointer1,Tag> &, const tagged_allocator<T2,Pointer2,Tag> &)
82 {
83   return true;
84 }
85
86
87 template<typename T1, typename Pointer1, typename T2, typename Pointer2, typename Tag>
88 __host__ __device__
89 bool operator!=(const tagged_allocator<T1,Pointer1,Tag> &, const tagged_allocator<T2,Pointer2,Tag> &)
90 {
91   return false;
92 }
93     
94
95 } // end detail
96 } // end thrust
97