1 #ifndef theplu_yat_utility_segment 2 #define theplu_yat_utility_segment 25 #include "yat_assert.h" 46 template<
typename T,
class Compare = std::less<T> >
66 : begin_(begin), end_(end) {}
71 T&
begin(
void) {
return begin_; }
76 const T&
begin(
void)
const {
return begin_; }
81 T&
end(
void) {
return end_; }
86 const T&
end(
void)
const {
return end_; }
124 template<
typename T,
class Compare>
130 || comp(lhs.
end(), rhs.
end()) || comp(rhs.
end(), lhs.
end());
143 template<
typename T,
class Compare>
166 template<
typename T,
class Compare>
171 YAT_ASSERT(!c(lhs.
end(), lhs.
begin()));
172 YAT_ASSERT(!c(rhs.
end(), rhs.
begin()));
191 template<
typename T,
class Compare>
210 template<
typename T,
class Compare>
215 if (comp(element, segment.
begin()))
217 if (comp(element, segment.
end()))
229 template<
typename T,
class Compare>
245 template<
typename T,
class Compare>
255 std::min(a.
end(), b.
end(), comp),
274 template<
typename T,
class Compare>
292 template<
typename T,
class Compare>
309 template<
typename T,
class Compare>
320 template<
typename T,
class Compare>
322 public std::binary_function<Segment<T,Compare>, Segment<T,Compare>, bool>
bool includes(const yat::utility::Segment< T, Compare > &lhs, const yat::utility::Segment< T, Compare > &rhs)
Definition: Segment.h:293
const T & begin(void) const
Definition: Segment.h:76
The Department of Theoretical Physics namespace as we define it.
T & end(void)
Definition: Segment.h:81
T value_type
Definition: Segment.h:53
Segment< T, Compare > set_union(const Segment< T, Compare > &a, const Segment< T, Compare > &b)
union of two segments
Definition: Segment.h:275
const T & end(void) const
Definition: Segment.h:86
Segment< T > make_segment(T first, T last)
Definition: Segment.h:104
T max(const T &a, const T &b, const T &c)
Definition: stl_utility.h:697
Segment(void)
default constructor
Definition: Segment.h:58
functor using compare
Definition: Segment.h:321
int compare_3way(const T &element, const Segment< T, Compare > &segment)
Definition: Segment.h:211
a class for a Segment or Interval
Definition: Segment.h:47
bool operator==(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Definition: Segment.h:144
Segment< T, Compare > intersection(const Segment< T, Compare > &a, const Segment< T, Compare > &b)
Definition: Segment.h:246
int compare_3way(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Definition: Segment.h:192
bool operator()(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs) const
Definition: Segment.h:327
bool operator!=(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Inequality operator.
Definition: Segment.h:125
bool compare(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Definition: Segment.h:167
Segment(const T &begin, const T &end)
Constructor.
Definition: Segment.h:65
T & begin(void)
Definition: Segment.h:71
bool overlap(const yat::utility::Segment< T, Compare > &lhs, const yat::utility::Segment< T, Compare > &rhs)
Definition: Segment.h:310
int compare_3way(const Segment< T, Compare > &segment, const T &element)
Definition: Segment.h:230