00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef QPAIR_H
00041 #define QPAIR_H
00042
00043 #ifndef QT_H
00044 #include "qglobal.h"
00045 #include "qdatastream.h"
00046 #endif // QT_H
00047
00048 template <class T1, class T2>
00049 struct QPair
00050 {
00051 typedef T1 first_type;
00052 typedef T2 second_type;
00053
00054 QPair()
00055 : first( T1() ), second( T2() )
00056 {}
00057 QPair( const T1& t1, const T2& t2 )
00058 : first( t1 ), second( t2 )
00059 {}
00060
00061 T1 first;
00062 T2 second;
00063 };
00064
00065 template <class T1, class T2>
00066 inline bool operator==( const QPair<T1, T2>& x, const QPair<T1, T2>& y )
00067 {
00068 return x.first == y.first && x.second == y.second;
00069 }
00070
00071 template <class T1, class T2>
00072 inline bool operator<( const QPair<T1, T2>& x, const QPair<T1, T2>& y )
00073 {
00074 return x.first < y.first ||
00075 ( !( y.first < x.first ) && x.second < y.second );
00076 }
00077
00078 template <class T1, class T2>
00079 inline QPair<T1, T2> qMakePair( const T1& x, const T2& y )
00080 {
00081 return QPair<T1, T2>( x, y );
00082 }
00083
00084 #ifndef QT_NO_DATASTREAM
00085 template <class T1, class T2>
00086 inline QDataStream& operator>>( QDataStream& s, QPair<T1, T2>& p )
00087 {
00088 s >> p.first >> p.second;
00089 return s;
00090 }
00091
00092 template <class T1, class T2>
00093 inline QDataStream& operator<<( QDataStream& s, const QPair<T1, T2>& p )
00094 {
00095 s << p.first << p.second;
00096 return s;
00097 }
00098 #endif
00099
00100 #endif