Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

vdbl_triple.h

Go to the documentation of this file.
00001 // Triple implementation -*- C++ -*-
00002 
00003 // Copyright (C) 2003 Hermann Schichl
00004 //
00005 // This file is part of the Vienna Database Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the Library GNU General Public License as published by the
00008 // Free Software Foundation; either version 2, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // Library GNU General Public License for more details.
00015 
00016 // As a special exception, you may use this file as part of a free software
00017 // library without restriction.  Specifically, if other files instantiate
00018 // templates or use macros or inline functions from this file, or you compile
00019 // this file and link it with other files to produce an executable, this
00020 // file does not by itself cause the resulting executable to be covered by
00021 // the Library GNU General Public License.  This exception does not however
00022 // invalidate any other reasons why the executable file might be covered by
00023 // the Library GNU General Public License.
00024 
00030 #ifndef __VDBL_TRIPLE_H
00031 #define __VDBL_TRIPLE_H
00032 
00033 __VDBL_BEGIN_NAMESPACE
00034 
00036 
00040 template <class _T1, class _T2, class _T3>
00041 struct triple {
00043   typedef _T1 first_type;    
00044 
00045   typedef _T2 second_type;   
00046 
00047   typedef _T3 third_type;    
00048 
00050   _T1 first;                 
00051 
00052   _T2 second;                
00053 
00054   _T3 third;                 
00055 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00056 //265.  vdbl::triple::triple() effects overly restrictive
00061   triple() : first(), second(), third() {}
00062 #else
00063   triple() : first(_T1()), second(_T2()), third(_T3()) {}
00064 #endif
00065 
00068   triple(const _T1& __a, const _T2& __b, const _T3& __c) : first(__a),
00069                                                 second(__b), third(__c) {}
00070 
00074   template <class _U1, class _U2, class _U3>
00075   triple(const triple<_U1, _U2, _U3>& __t) : first(__t.first),
00076                                              second(__t.second),
00077                                              third(__t.third) {}
00078 };
00079 
00081 template <class _T1, class _T2, class _T3>
00082 inline bool operator==(const triple<_T1, _T2, _T3>& __x,
00083                        const triple<_T1, _T2, _T3>& __y)
00084 { 
00085   return __x.first == __y.first && __x.second == __y.second &&
00086          __x.third == __y.third; 
00087 }
00088 
00090 template <class _T1, class _T2, class _T3>
00091 inline bool operator<(const triple<_T1, _T2, _T3>& __x,
00092                       const triple<_T1, _T2, _T3>& __y)
00093 { 
00094   return __x.first < __y.first || 
00095          (!(__y.first < __x.first) && __x.second < __y.second) ||
00096          (!(__x.first < __y.first) && !(__x.second < __y.second) &&
00097           __x.third < __y.third);
00098 }
00099 
00101 template <class _T1, class _T2, class _T3>
00102 inline bool operator!=(const triple<_T1, _T2, _T3>& __x,
00103                        const triple<_T1, _T2, _T3>& __y) {
00104   return !(__x == __y);
00105 }
00106 
00108 template <class _T1, class _T2, class _T3>
00109 inline bool operator>(const triple<_T1, _T2, _T3>& __x,
00110                       const triple<_T1, _T2, _T3>& __y) {
00111   return __y < __x;
00112 }
00113 
00115 template <class _T1, class _T2, class _T3>
00116 inline bool operator<=(const triple<_T1, _T2, _T3>& __x,
00117                        const triple<_T1, _T2, _T3>& __y) {
00118   return !(__y < __x);
00119 }
00120 
00122 template <class _T1, class _T2, class _T3>
00123 inline bool operator>=(const triple<_T1, _T2, _T3>& __x,
00124                        const triple<_T1, _T2, _T3>& __y) {
00125   return !(__x < __y);
00126 }
00127 
00135 template <class _T1, class _T2, class _T3>
00136 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00137 //181.  make_triple() unintended behavior
00138 inline triple<_T1, _T2, _T3> make_triple(_T1 __x, _T2 __y, _T3 __z)
00139 #else
00140 inline triple<_T1, _T2, _T3> make_triple(const _T1& __x, const _T2& __y,
00141                                          const _T3& __z)
00142 #endif
00143 {
00144   return triple<_T1, _T2, _T3>(__x, __y, __z);
00145 }
00146 
00147 __VDBL_END_NAMESPACE
00148 
00149 #endif /* __VDBL_TRIPLE_H */
00150 
00151 // Local Variables:
00152 // mode:C++
00153 // End:

Generated on Tue Nov 4 01:29:11 2003 for Vienna Database Library by doxygen1.2.18