Program Listing for File pair.h

Return to documentation for file (thrust/pair.h)

/*
 *  Copyright 2008-2013 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.
 */

#pragma once

#include <thrust/detail/config.h>
#include <utility>

namespace thrust
{

template <typename T1, typename T2>
  struct pair
{
  typedef T1 first_type;

  typedef T2 second_type;

  first_type first;

  second_type second;

  __host__ __device__ pair(void);

  inline __host__ __device__
  pair(const T1 &x, const T2 &y);

  template <typename U1, typename U2>
  inline __host__ __device__
  pair(const pair<U1,U2> &p);

  template <typename U1, typename U2>
  inline __host__ __device__
  pair(const std::pair<U1,U2> &p);

  inline __host__ __device__
  void swap(pair &p);
}; // end pair


template <typename T1, typename T2>
  inline __host__ __device__
    bool operator==(const pair<T1,T2> &x, const pair<T1,T2> &y);


template <typename T1, typename T2>
  inline __host__ __device__
    bool operator<(const pair<T1,T2> &x, const pair<T1,T2> &y);


template <typename T1, typename T2>
  inline __host__ __device__
    bool operator!=(const pair<T1,T2> &x, const pair<T1,T2> &y);


template <typename T1, typename T2>
  inline __host__ __device__
    bool operator>(const pair<T1,T2> &x, const pair<T1,T2> &y);


template <typename T1, typename T2>
  inline __host__ __device__
    bool operator<=(const pair<T1,T2> &x, const pair<T1,T2> &y);


template <typename T1, typename T2>
  inline __host__ __device__
    bool operator>=(const pair<T1,T2> &x, const pair<T1,T2> &y);


template <typename T1, typename T2>
  inline __host__ __device__
    void swap(pair<T1,T2> &x, pair<T1,T2> &y);


template <typename T1, typename T2>
  inline __host__ __device__
    pair<T1,T2> make_pair(T1 x, T2 y);


template<int N, typename T> struct tuple_element;


template<typename Pair> struct tuple_size;


// 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);


// 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);

} // end thrust

#include <thrust/detail/pair.inl>