/usr/include/thrust/pair.h is in libthrust-dev 1.6.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | /*
* Copyright 2008-2012 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*! \file pair.h
* \brief A type encapsulating a heterogeneous pair of elements
*/
#pragma once
#include <thrust/detail/config.h>
#include <utility>
namespace thrust
{
/*! \addtogroup utility
* \{
*/
/*! \addtogroup pair
* \{
*/
/*! \p pair is a generic data structure encapsulating a heterogeneous
* pair of values.
*
* \tparam T1 The type of \p pair's first object type. There are no
* requirements on the type of \p T1. <tt>T1</tt>'s type is
* provided by <tt>pair::first_type</tt>.
*
* \tparam T2 The type of \p pair's second object type. There are no
* requirements on the type of \p T2. <tt>T2</tt>'s type is
* provided by <tt>pair::second_type</tt>.
*/
template <typename T1, typename T2>
struct pair
{
/*! \p first_type is the type of \p pair's first object type.
*/
typedef T1 first_type;
/*! \p second_type is the type of \p pair's second object type.
*/
typedef T2 second_type;
/*! The \p pair's first object.
*/
first_type first;
/*! The \p pair's second object.
*/
second_type second;
/*! \p pair's default constructor constructs \p first
* and \p second using \c first_type & \c second_type's
* default constructors, respectively.
*/
__host__ __device__ pair(void);
/*! This constructor accepts two objects to copy into this \p pair.
*
* \param x The object to copy into \p first.
* \param y The object to copy into \p second.
*/
inline __host__ __device__
pair(const T1 &x, const T2 &y);
/*! This copy constructor copies from a \p pair whose types are
* convertible to this \p pair's \c first_type and \c second_type,
* respectively.
*
* \param p The \p pair to copy from.
*
* \tparam U1 is convertible to \c first_type.
* \tparam U2 is convertible to \c second_type.
*/
template <typename U1, typename U2>
inline __host__ __device__
pair(const pair<U1,U2> &p);
/*! This copy constructor copies from a <tt>std::pair</tt> whose types are
* convertible to this \p pair's \c first_type and \c second_type,
* respectively.
*
* \param p The <tt>std::pair</tt> to copy from.
*
* \tparam U1 is convertible to \c first_type.
* \tparam U2 is convertible to \c second_type.
*/
template <typename U1, typename U2>
inline __host__ __device__
pair(const std::pair<U1,U2> &p);
/*! \p swap swaps the elements of two <tt>pair</tt>s.
*
* \param p The other <tt>pair</tt> with which to swap.
*/
inline __host__ __device__
void swap(pair &p);
}; // end pair
/*! This operator tests two \p pairs for equality.
*
* \param x The first \p pair to compare.
* \param y The second \p pair to compare.
* \return \c true if and only if <tt>x.first == y.first && x.second == y.second</tt>.
*
* \tparam T1 is a model of <a href="http://www.sgi.com/tech/stl/EqualityComparable.html">Equality Comparable</a>.
* \tparam T2 is a model of <a href="http://www.sgi.com/tech/stl/EqualityComparable.html">Equality Comparable</a>.
*/
template <typename T1, typename T2>
inline __host__ __device__
bool operator==(const pair<T1,T2> &x, const pair<T1,T2> &y);
/*! This operator tests two pairs for ascending ordering.
*
* \param x The first \p pair to compare.
* \param y The second \p pair to compare.
* \return \c true if and only if <tt>x.first < y.first || (!(y.first < x.first) && x.second < y.second)</tt>.
*
* \tparam T1 is a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan Comparable</a>.
* \tparam T2 is a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan Comparable</a>.
*/
template <typename T1, typename T2>
inline __host__ __device__
bool operator<(const pair<T1,T2> &x, const pair<T1,T2> &y);
/*! This operator tests two pairs for inequality.
*
* \param x The first \p pair to compare.
* \param y The second \p pair to compare.
* \return \c true if and only if <tt>!(x == y)</tt>.
*
* \tparam T1 is a model of <a href="http://www.sgi.com/tech/stl/EqualityComparable.html">Equality Comparable</a>.
* \tparam T2 is a model of <a href="http://www.sgi.com/tech/stl/EqualityComparable.html">Equality Comparable</a>.
*/
template <typename T1, typename T2>
inline __host__ __device__
bool operator!=(const pair<T1,T2> &x, const pair<T1,T2> &y);
/*! This operator tests two pairs for descending ordering.
*
* \param x The first \p pair to compare.
* \param y The second \p pair to compare.
* \return \c true if and only if <tt>y < x</tt>.
*
* \tparam T1 is a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan Comparable</a>.
* \tparam T2 is a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan Comparable</a>.
*/
template <typename T1, typename T2>
inline __host__ __device__
bool operator>(const pair<T1,T2> &x, const pair<T1,T2> &y);
/*! This operator tests two pairs for ascending ordering or equivalence.
*
* \param x The first \p pair to compare.
* \param y The second \p pair to compare.
* \return \c true if and only if <tt>!(y < x)</tt>.
*
* \tparam T1 is a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan Comparable</a>.
* \tparam T2 is a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan Comparable</a>.
*/
template <typename T1, typename T2>
inline __host__ __device__
bool operator<=(const pair<T1,T2> &x, const pair<T1,T2> &y);
/*! This operator tests two pairs for descending ordering or equivalence.
*
* \param x The first \p pair to compare.
* \param y The second \p pair to compare.
* \return \c true if and only if <tt>!(x < y)</tt>.
*
* \tparam T1 is a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan Comparable</a>.
* \tparam T2 is a model of <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan Comparable</a>.
*/
template <typename T1, typename T2>
inline __host__ __device__
bool operator>=(const pair<T1,T2> &x, const pair<T1,T2> &y);
/*! \p swap swaps the contents of two <tt>pair</tt>s.
*
* \param x The first \p pair to swap.
* \param y The second \p pair to swap.
*/
template <typename T1, typename T2>
inline __host__ __device__
void swap(pair<T1,T2> &x, pair<T1,T2> &y);
/*! This convenience function creates a \p pair from two objects.
*
* \param x The first object to copy from.
* \param y The second object to copy from.
* \return A newly-constructed \p pair copied from \p a and \p b.
*
* \tparam T1 There are no requirements on the type of \p T1.
* \tparam T2 There are no requirements on the type of \p T2.
*/
template <typename T1, typename T2>
inline __host__ __device__
pair<T1,T2> make_pair(T1 x, T2 y);
/*! This convenience metafunction is included for compatibility with
* \p tuple. It returns either the type of a \p pair's
* \c first_type or \c second_type in its nested type, \c type.
*
* \tparam N This parameter selects the member of interest.
* \tparam T A \c pair type of interest.
*/
template<int N, typename T> struct tuple_element;
/*! This convenience metafunction is included for compatibility with
* \p tuple. It returns \c 2, the number of elements of a \p pair,
* in its nested data member, \c value.
*
* \tparam Pair A \c pair type of interest.
*/
template<typename Pair> struct tuple_size;
/*! This convenience function returns a reference to either the first or
* second member of a \p pair.
*
* \param p The \p pair of interest.
* \return \c p.first or \c p.second, depending on the template
* parameter.
*
* \tparam N This parameter selects the member of interest.
*/
// XXX comment out these prototypes as a WAR to a problem on MSVC 2005
//template<unsigned int N, typename T1, typename T2>
// inline __host__ __device__
// typename tuple_element<N, pair<T1,T2> >::type &
// get(pair<T1,T2> &p);
/*! This convenience function returns a const reference to either the
* first or second member of a \p pair.
*
* \param p The \p pair of interest.
* \return \c p.first or \c p.second, depending on the template
* parameter.
*
* \tparam i This parameter selects the member of interest.
*/
// XXX comment out these prototypes as a WAR to a problem on MSVC 2005
//template<int N, typename T1, typename T2>
// inline __host__ __device__
// const typename tuple_element<N, pair<T1,T2> >::type &
// get(const pair<T1,T2> &p);
/*! \} // pair
*/
/*! \} // utility
*/
} // end thrust
#include <thrust/detail/pair.inl>
|