00001
00002 #ifndef vbl_triple_h_
00003 #define vbl_triple_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012 #include <vcl_iosfwd.h>
00013
00014
00015 template <class T1, class T2, class T3>
00016 struct vbl_triple
00017 {
00018 typedef T1 first_type;
00019 typedef T2 second_type;
00020 typedef T3 third_type;
00021
00022 T1 first;
00023 T2 second;
00024 T3 third;
00025
00026 vbl_triple() { }
00027 vbl_triple(T1 const &a, T2 const &b, T3 const &c)
00028 : first (a)
00029 , second(b)
00030 , third (c) { }
00031 #if VCL_HAS_MEMBER_TEMPLATES
00032 template <class U1, class U2, class U3>
00033 vbl_triple(vbl_triple<U1, U2, U3> const &that)
00034 : first (that.first )
00035 , second(that.second)
00036 , third (that.third ) { }
00037 #endif
00038 };
00039
00040 template <class T1, class T2, class T3>
00041 inline bool operator==(vbl_triple<T1, T2, T3> const &x, vbl_triple<T1, T2, T3> const &y)
00042 {
00043 return
00044 x.first == y.first &&
00045 x.second == y.second &&
00046 x.third == y.third;
00047 }
00048
00049 template <class T1, class T2, class T3>
00050 inline bool operator!=(vbl_triple<T1, T2, T3> const &x, vbl_triple<T1, T2, T3> const &y)
00051 { return !(x == y); }
00052
00053 template <class T1, class T2, class T3>
00054 inline bool operator< (vbl_triple<T1, T2, T3> const &x, vbl_triple<T1, T2, T3> const &y)
00055 {
00056 return x.first!=y.first ? x.first<y.first :
00057 (x.second!=y.second ? x.second<y.second : x.third<y.third);
00058 }
00059
00060 template <class T1, class T2, class T3>
00061 inline vbl_triple<T1, T2, T3> vbl_make_triple(T1 const &x, T2 const &y, T3 const &z)
00062 {
00063 return vbl_triple<T1, T2, T3>(x, y, z);
00064 }
00065
00066 template <class T1, class T2, class T3>
00067 inline vcl_ostream& operator<<(vcl_ostream& os, vbl_triple<T1, T2, T3> const &x)
00068 {
00069 return os << x.first << ' ' << x.second << ' ' << x.third;
00070 }
00071
00072 template <class T1, class T2, class T3>
00073 inline vcl_istream& operator>>(vcl_istream& os, vbl_triple<T1, T2, T3> &x)
00074 {
00075 return os >> x.first >> x.second >> x.third;
00076 }
00077
00078
00079 #endif // vbl_triple_h_