Changeset 2293 for trunk/yat/utility/Segment.h
- Timestamp:
- Jul 7, 2010, 6:33:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/Segment.h
r2291 r2293 143 143 } 144 144 145 /** 146 \return intersection of \a a and \a b. If \a a and \b do not 147 overlap an empty Section is returned (begin==end), but the exact 148 value of begin is undefined. 149 150 \relates Segment 151 152 \since new in yat 0.7 153 */ 154 template<typename T, class Compare> 155 Segment<T, Compare> intersection(const Segment<T, Compare>& a, 156 const Segment<T, Compare>& b) 157 { 158 Compare comp; 159 Segment<T, Compare> result; 160 161 result.begin() = std::max(a.begin(), b.begin(), comp); 162 result.end() = std::max(result.begin(), 163 std::min(a.end(), b.end(), comp), 164 comp); 165 return result; 166 } 167 145 168 }}} 146 169 #endif
Note: See TracChangeset
for help on using the changeset viewer.