ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/utils/Tuple.hpp
(Generate patch)

Comparing branches/development/src/utils/Tuple.hpp (file contents):
Revision 1873 by gezelter, Wed Feb 20 15:39:39 2013 UTC vs.
Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC

# Line 83 | Line 83 | namespace OpenMD {
83    tuple4<T1,T2,T3,T4> make_tuple4( T1 t1, T2 t2, T3 t3, T4 t4 ) {
84      return tuple4<T1,T2,T3,T4>( t1, t2, t3, t4 );
85    }
86
87 template<class T1, class T2, class T3>
88 inline bool operator < (const tuple3<T1, T2, T3>& t1, const tuple3<T1, T2, T3>& t2) {
89
90        return t1.first < t2.first
91             || (!(t2.first < t1.first) && t1.second < t2.second)
92             || (!(t2.first < t1.first) && !(t2.second < t2.second) && t1.third < t2.third);
93 }
94
95
96 inline bool operator < (const tuple3<int, int, std::vector<std::string> >& t1, const tuple3<int, int, std::vector<std::string> >& t2) {
86    
87 <  if (t1.first < t2.first)
88 <    return true;
100 <  else {
101 <    if (t1.first > t2.first)
102 <      return false;
87 >  template<class T1, class T2, class T3>
88 >  inline bool operator < (const tuple3<T1, T2, T3>& t1, const tuple3<T1, T2, T3>& t2) {
89      
90 <    if (t1.second < t2.second)
90 >    return t1.first < t2.first
91 >      || (!(t2.first < t1.first) && t1.second < t2.second)
92 >      || (!(t2.first < t1.first) && !(t2.second < t1.second) && t1.third < t2.third);
93 >  }
94 >  
95 >  
96 >  inline bool operator < (const tuple3<int, int, std::vector<std::string> >& t1, const tuple3<int, int, std::vector<std::string> >& t2) {
97 >    
98 >    if (t1.first < t2.first)
99        return true;
100 <    else
101 <      if (t1.second > t2.second)
102 <        return false;
100 >    else {
101 >      if (t1.first > t2.first)
102 >        return false;
103      
104 <    return true;
105 <  }  
106 < }
104 >      if (t1.second < t2.second)
105 >        return true;
106 >      else
107 >        if (t1.second > t2.second)
108 >          return false;
109 >    
110 >      return true;
111 >    }  
112 >  }
113  
114 < template<class T1, class T2, class T3, class T4>
115 < inline bool operator < (const tuple4<T1, T2, T3, T4>& t1, const tuple4<T1, T2, T3, T4>& t2) {
114 >  template<class T1, class T2, class T3, class T4>
115 >  inline bool operator < (const tuple4<T1, T2, T3, T4>& t1, const tuple4<T1, T2, T3, T4>& t2) {
116 >  
117 >    return t1.first < t2.first
118 >      || (!(t2.first < t1.first) && t1.second < t2.second)
119 >      || (!(t2.first < t1.first) && !(t2.second < t1.second) && t1.third < t2.third)
120 >      || (!(t2.first < t1.first) && !(t2.second < t1.second) && !(t2.third < t1.third) && t1.fourth < t2.fourth);
121 >  }
122 >  typedef tuple3<int, int, int> IntTuple3;
123 >  typedef tuple4<int, int, int, int> IntTuple4;
124  
117        return t1.first < t2.first
118             || (!(t2.first < t1.first) && t1.second < t2.second)
119             || (!(t2.first < t1.first) && !(t2.second < t2.second) && t1.third < t2.third)
120             ||(!(t2.first < t1.first) && !(t2.second < t2.second) && !(t2.third < t1.third) && t1.fourth < t2.fourth);
125   }
122 typedef tuple3<int, int, int> IntTuple3;
123 typedef tuple4<int, int, int, int> IntTuple4;
126  
125 }
127  
127
128   #endif //UTILS_TUPLE_HPP
129  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines