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 THRUST_NAMESPACE_BEGIN
27 
47 template <typename T1, typename T2>
48  struct pair
49 {
52  typedef T1 first_type;
53 
56  typedef T2 second_type;
57 
60  first_type first;
61 
64  second_type second;
65 
70  __host__ __device__ pair(void);
71 
77  inline __host__ __device__
78  pair(const T1 &x, const T2 &y);
79 
89  template <typename U1, typename U2>
90  inline __host__ __device__
91  pair(const pair<U1,U2> &p);
92 
102  template <typename U1, typename U2>
103  inline __host__ __device__
104  pair(const std::pair<U1,U2> &p);
105 
110  inline __host__ __device__
111  void swap(pair &p);
112 }; // end pair
113 
114 
124 template <typename T1, typename T2>
125  inline __host__ __device__
126  bool operator==(const pair<T1,T2> &x, const pair<T1,T2> &y);
127 
128 
138 template <typename T1, typename T2>
139  inline __host__ __device__
140  bool operator<(const pair<T1,T2> &x, const pair<T1,T2> &y);
141 
142 
152 template <typename T1, typename T2>
153  inline __host__ __device__
154  bool operator!=(const pair<T1,T2> &x, const pair<T1,T2> &y);
155 
156 
166 template <typename T1, typename T2>
167  inline __host__ __device__
168  bool operator>(const pair<T1,T2> &x, const pair<T1,T2> &y);
169 
170 
180 template <typename T1, typename T2>
181  inline __host__ __device__
182  bool operator<=(const pair<T1,T2> &x, const pair<T1,T2> &y);
183 
184 
194 template <typename T1, typename T2>
195  inline __host__ __device__
196  bool operator>=(const pair<T1,T2> &x, const pair<T1,T2> &y);
197 
198 
204 template <typename T1, typename T2>
205  inline __host__ __device__
206  void swap(pair<T1,T2> &x, pair<T1,T2> &y);
207 
208 
218 template <typename T1, typename T2>
219  inline __host__ __device__
220  pair<T1,T2> make_pair(T1 x, T2 y);
221 
222 
230 template<size_t N, class T> struct tuple_element;
231 
232 
239 template<typename Pair> struct tuple_size;
240 
241 
251 // XXX comment out these prototypes as a WAR to a problem on MSVC 2005
252 //template<unsigned int N, typename T1, typename T2>
253 // inline __host__ __device__
254 // typename tuple_element<N, pair<T1,T2> >::type &
255 // get(pair<T1,T2> &p);
256 
257 
267 // XXX comment out these prototypes as a WAR to a problem on MSVC 2005
268 //template<int N, typename T1, typename T2>
269 // inline __host__ __device__
270 // const typename tuple_element<N, pair<T1,T2> >::type &
271 // get(const pair<T1,T2> &p);
272 
279 THRUST_NAMESPACE_END
280 
281 #include <thrust/detail/pair.inl>
__host__ __device__ void swap(pair< T1, T2 > &x, pair< T1, T2 > &y)
second_type second
Definition: pair.h:64
T1 first_type
Definition: pair.h:52
Definition: pair.h:48
Definition: pair.h:230
__host__ __device__ bool operator>=(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
T2 second_type
Definition: pair.h:56
first_type first
Definition: pair.h:60
__host__ __device__ pair< T1, T2 > make_pair(T1 x, T2 y)
Definition: pair.h:239
__host__ __device__ bool operator==(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
__host__ __device__ bool operator!=(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
__host__ __device__ bool operator>(const pair< T1, T2 > &x, const pair< T1, T2 > &y)