|
Sierra Toolkit
Version of the Day
|
00001 #ifndef RDESTL_PAIR_H 00002 #define RDESTL_PAIR_H 00003 00004 #include <stk_util/util/type_traits_rdestl.h> 00005 00006 namespace rde 00007 { 00008 //============================================================================= 00009 template<typename T1, typename T2> 00010 struct pair 00011 { 00012 typedef T1 first_type; 00013 typedef T2 second_type; 00014 00015 pair() {} 00016 pair(const T1& a, const T2& b): first(a), second(b) {} 00017 explicit pair(const T1& a): first(a) {} 00018 00019 pair(const pair<T1,T2>& rhs) : first(rhs.first), second(rhs.second) {} 00020 00021 pair& operator=(const pair<T1,T2>& rhs) 00022 { 00023 first = rhs.first; 00024 second = rhs.second; 00025 return *this; 00026 } 00027 00028 T1 first; 00029 T2 second; 00030 }; 00031 00032 //============================================================================= 00033 // Pair is POD if every element is POD/fundamental 00034 template<typename T1, typename T2> struct is_pod<pair<T1, T2> > 00035 { 00036 enum { value = (is_pod<T1>::value || is_fundamental<T1>::value) && 00037 (is_pod<T2>::value || is_fundamental<T2>::value) }; 00038 }; 00039 00040 //----------------------------------------------------------------------------- 00041 template<typename T1, typename T2> 00042 pair<T1, T2> make_pair(const T1& a, const T2& b) 00043 { 00044 return pair<T1, T2>(a, b); 00045 } 00046 00047 } 00048 00049 //----------------------------------------------------------------------------- 00050 #endif // #ifndef RDESTL_PAIR_H