thrust
pair.h
Go to the documentation of this file.
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 
21 #pragma once
22 
23 #include <thrust/detail/config.h>
24 #include <utility>
25 
26 namespace thrust
27 {
28 
48 template <typename T1, typename T2>
49  struct pair
50 {
53  typedef T1 first_type;
54 
57  typedef T2 second_type;
58 
61  first_type first;
62 
65  second_type second;
66 
71  __host__ __device__ pair(void);
72 
78  inline __host__ __device__
79  pair(const T1 &x, const T2 &y);
80 
90  template <typename U1, typename U2>
91  inline __host__ __device__
92  pair(const pair<U1,U2> &p);
93 
103  template <typename U1, typename U2>
104  inline __host__ __device__
105  pair(const std::pair<U1,U2> &p);
106 
111  inline __host__ __device__
112  void swap(pair &p);
113 }; // end pair
114 
115 
125 template <typename T1, typename T2>
126  inline __host__ __device__
127  bool operator==(const pair<T1,T2> &x, const pair<T1,T2> &y);
128 
129 
139 template <typename T1, typename T2>
140  inline __host__ __device__
141  bool operator<(const pair<T1,T2> &x, const pair<T1,T2> &y);
142 
143 
153 template <typename T1, typename T2>
154  inline __host__ __device__
155  bool operator!=(const pair<T1,T2> &x, const pair<T1,T2> &y);
156 
157 
167 template <typename T1, typename T2>
168  inline __host__ __device__
169  bool operator>(const pair<T1,T2> &x, const pair<T1,T2> &y);
170 
171 
181 template <typename T1, typename T2>
182  inline __host__ __device__
183  bool operator<=(const pair<T1,T2> &x, const pair<T1,T2> &y);
184 
185 
195 template <typename T1, typename T2>
196  inline __host__ __device__
197  bool operator>=(const pair<T1,T2> &x, const pair<T1,T2> &y);
198 
199 
205 template <typename T1, typename T2>
206  inline __host__ __device__
207  void swap(pair<T1,T2> &x, pair<T1,T2> &y);
208 
209 
219 template <typename T1, typename T2>
220  inline __host__ __device__
221  pair<T1,T2> make_pair(T1 x, T2 y);
222 
223 
231 template<int N, typename T> struct tuple_element;
232 
233 
240 template<typename Pair> struct tuple_size;
241 
242 
252 // XXX comment out these prototypes as a WAR to a problem on MSVC 2005
253 //template<unsigned int N, typename T1, typename T2>
254 // inline __host__ __device__
255 // typename tuple_element<N, pair<T1,T2> >::type &
256 // get(pair<T1,T2> &p);
257 
258 
268 // XXX comment out these prototypes as a WAR to a problem on MSVC 2005
269 //template<int N, typename T1, typename T2>
270 // inline __host__ __device__
271 // const typename tuple_element<N, pair<T1,T2> >::type &
272 // get(const pair<T1,T2> &p);
273 
280 } // end thrust
281 
282 #include <thrust/detail/pair.inl>
283 
second_type second
Definition: pair.h:65
T1 first_type
Definition: pair.h:53
__host__ __device__ void swap(pair &p)
Definition: pair.h:49
Definition: pair.h:231
__host__ __device__ bool operator>=(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
thrust is the top-level namespace which contains all Thrust functions and types.
Definition: addressof.h:14
__host__ __device__ pair(void)
T2 second_type
Definition: pair.h:57
__host__ __device__ bool operator!=(const complex< T0 > &x, const complex< T1 > &y)
__host__ __device__ bool operator==(const complex< T0 > &x, const complex< T1 > &y)
first_type first
Definition: pair.h:61
__host__ __device__ pair< T1, T2 > make_pair(T1 x, T2 y)
Definition: pair.h:240
__host__ __device__ bool operator>(const pair< T1, T2 > &x, const pair< T1, T2 > &y)