bbq Implementation Documentation
Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

triple.h

Go to the documentation of this file.
00001 #ifndef __GLIBCPP_INTERNAL_TRIPLE_H
00002 #define __GLIBCPP_INTERNAL_TRIPLE_H
00003 
00004 namespace std
00005 {
00006 
00020 template <class _T1, class _T2, class _T3>
00021 struct triple {
00022   typedef _T1 first_type;    
00023   typedef _T2 second_type;   
00024   typedef _T3 third_type;    
00025 
00026   _T1 first;                 
00027   _T2 second;                
00028   _T3 third;                
00029 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00030 //265.  std::triple::triple() effects overly restrictive
00033   triple() : first(), second(), third() {}
00034 #else
00035   triple() : first(_T1()), second(_T2()), third (_T3()) {}
00036 #endif
00037 
00038   triple(const _T1& __a, const _T2& __b, const _T3& __c) : first(__a), second(__b), third(__c) {}
00039 
00041   template <class _U1, class _U2, class _U3>
00042   triple(const triple<_U1, _U2, _U3>& __p) : first(__p.first), second(__p.second), third(__p.third) {}
00043 };
00044 
00046 template <class _T1, class _T2, class _T3>
00047 inline bool operator==(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y)
00048 { 
00049         return __x.first == __y.first && __x.second == __y.second && __x.third == __y.third;
00050 }
00051 
00053 template <class _T1, class _T2, class _T3>
00054 inline bool operator<(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y)
00055 { 
00056   return __x.first < __y.first || 
00057          (!(__y.first < __x.first) && __x.second < __y.second) ||
00058           ((!(__y.first < __x.first) && !(__y.second < __x.second) && __x.third < __y.third)); 
00059 }
00060 
00062 template <class _T1, class _T2, class _T3>
00063 inline bool operator!=(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y) {
00064   return !(__x == __y);
00065 }
00066 
00068 template <class _T1, class _T2, class _T3>
00069 inline bool operator>(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y) {
00070   return __y < __x;
00071 }
00072 
00074 template <class _T1, class _T2, class _T3>
00075 inline bool operator<=(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y) {
00076   return !(__y < __x);
00077 }
00078 
00080 template <class _T1, class _T2, class _T3>
00081 inline bool operator>=(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y) {
00082   return !(__x < __y);
00083 }
00084 
00096 template <class _T1, class _T2, class _T3>
00097 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00098 //181.  make_triple() unintended behavior
00099 inline triple<_T1, _T2, _T3> make_triple(_T1 __x, _T2 __y, _T3 __z)
00100 #else
00101 inline triple<_T1, _T2, _T3> make_triple(const _T1& __x, const _T2& __y, const _T3& __z)
00102 #endif
00103 {
00104   return triple<_T1, _T2, _T3>(__x, __y, __z);
00105 }
00106 
00107 } // namespace std
00108 
00109 #endif /* __GLIBCPP_INTERNAL_TRIPLE_H */
00110 
00111 // Local Variables:
00112 // mode:C++
00113 // End:
bbq Implementation Documentation
Axel Mosig, Bioinformatics, University of Leipzig