HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Pair.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_Pair.h ( UT Library, C++)
7  *
8  * COMMENTS: Simple templated pair of variables.
9  */
10 
11 #ifndef __UT_Pair__
12 #define __UT_Pair__
13 
14 #ifdef WIN32
15  #pragma warning(disable:4251)
16  #pragma warning(disable:4275)
17 #endif
18 
19 #include <SYS/SYS_Deprecated.h>
20 #include <utility>
21 
22 template <class T1, class T2>
23 class SYS_DEPRECATED_REPLACE(18.5, "std::pair") UT_Pair
24 {
25 public:
26  SYS_DEPRECATED_REPLACE(18.5, "std::pair")
28  : myFirst(T1()), mySecond(T2()) { }
29  SYS_DEPRECATED_REPLACE(18.5, "std::pair")
30  UT_Pair(const T1 &v1, const T2 &v2)
31  : myFirst(v1), mySecond(v2) { }
32 
33  template <class U1 = T1, class U2 = T2>
34  SYS_DEPRECATED_REPLACE(18.5, "std::pair")
35  UT_Pair(U1 &&v1, U2 &&v2)
36  : myFirst(std::forward<U1>(v1))
37  , mySecond(std::forward<U2>(v2))
38  { }
39 
40  bool operator==(const UT_Pair<T1, T2> &p) const
41  {
42  return (myFirst == p.myFirst) && (mySecond == p.mySecond);
43  }
44  bool operator!=(const UT_Pair<T1, T2> &p) const
45  {
46  return (myFirst != p.myFirst) || (mySecond != p.mySecond);
47  }
48 
49  T1 myFirst;
51 };
52 
54 
55 /// Common types
56 typedef UT_Pair<int,int> UT_IntPair;
57 
58 template<typename OS, typename T1, typename T2>
59 inline OS &
60 operator<<(OS &os, const UT_Pair<T1, T2> &p)
61 {
62  os << "UT_Pair(" << p.myFirst << ", " << p.mySecond << ")";
63  return os;
64 }
65 
66 // For UT::ArraySet.
67 namespace UT
68 {
69  template <typename T>
70  struct DefaultClearer;
71 
72  template <typename S0, typename S1>
73  struct DefaultClearer<UT_Pair<S0, S1>>
74  {
76 
77  static void clear(Type &v)
78  {
81  }
82 
83  static bool isClear(const Type& v)
84  {
87  }
88 
89  static void clearConstruct(Type *p)
90  {
93  }
94 
95  static const bool clearNeedsDestruction =
98  };
99 }
100 
102 
103 #endif
#define SYS_DEPRECATED_PUSH_DISABLE()
static void clearConstruct(Type *p)
Definition: UT_Pair.h:89
#define SYS_DEPRECATED_POP_DISABLE()
T2 mySecond
Definition: UT_Pair.h:50
bool operator==(const UT_Pair< T1, T2 > &p) const
Definition: UT_Pair.h:40
bool operator!=(const UT_Pair< T1, T2 > &p) const
Definition: UT_Pair.h:44
const GLdouble * v
Definition: glew.h:1391
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
GLfloat GLfloat GLfloat v2
Definition: glew.h:1856
T1 myFirst
Definition: UT_Pair.h:49
GLfloat GLfloat p
Definition: glew.h:16321
#define const
Definition: zconf.h:214
GLfloat GLfloat v1
Definition: glew.h:1852
static bool isClear(const Type &v)
Definition: UT_Pair.h:83