Extended CUDA Library (ecuda)  2.0
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
utility.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2015, Scott Zuyderduyn
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 The views and conclusions contained in the software and documentation are those
26 of the authors and should not be interpreted as representing official policies,
27 either expressed or implied, of the FreeBSD Project.
28 */
29 
30 //----------------------------------------------------------------------------
31 // utility.hpp
32 //
33 // Metaprogramming templates to get type traits at compile-time.
34 //
35 // Author: Scott D. Zuyderduyn, Ph.D. (scott.zuyderduyn@utoronto.ca)
36 //----------------------------------------------------------------------------
37 
38 #pragma once
39 #ifndef ECUDA_UTILITY_HPP
40 #define ECUDA_UTILITY_HPP
41 
42 #include "global.hpp"
43 #include "type_traits.hpp"
44 
45 namespace ecuda {
46 
52 template<typename T1,typename T2>
53 struct pair {
54  typedef T1 first_type;
55  typedef T2 second_type;
56  T1 first;
57  T2 second;
61  template<typename U,typename V> __HOST__ __DEVICE__ pair( const pair<U,V>& pr ) : first(pr.first), second(pr.second) {}
63  __HOST__ __DEVICE__ pair( const first_type& a, const second_type& b ) : first(a), second(b) {}
64 };
65 
66 } // namespace ecuda
67 
68 #endif
ECUDA_SUPPRESS_HD_WARNINGS __HOST__ __DEVICE__ pair()
Definition: utility.hpp:59
T1 first_type
Definition: utility.hpp:54
T2 second_type
Definition: utility.hpp:55
#define __HOST__
Definition: global.hpp:150
ECUDA_SUPPRESS_HD_WARNINGS __HOST__ __DEVICE__ pair(const pair< U, V > &pr)
Definition: utility.hpp:61
ECUDA_SUPPRESS_HD_WARNINGS __HOST__ __DEVICE__ pair(const first_type &a, const second_type &b)
Definition: utility.hpp:63
Couples together a pair of values.
Definition: utility.hpp:53
#define __DEVICE__
Definition: global.hpp:151
#define ECUDA_SUPPRESS_HD_WARNINGS
Definition: global.hpp:58