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_; }
112 template<
typename T,
class Compare>
117 YAT_ASSERT(!c(lhs.
end(), lhs.
begin()));
118 YAT_ASSERT(!c(rhs.
end(), rhs.
begin()));
137 template<
typename T,
class Compare>
141 if (compare(lhs, rhs))
143 if (compare(rhs, lhs))
156 template<
typename T,
class Compare>
161 if (comp(element, segment.
begin()))
163 if (comp(element, segment.
end()))
177 template<
typename T,
class Compare>
187 std::min(a.
end(), b.
end(), comp),
195 template<
typename T,
class Compare>
197 public std::binary_function<Segment<T,Compare>, Segment<T,Compare>, bool>
204 {
return compare(lhs, rhs); }
const T & begin(void) const
Definition: Segment.h:76
T & end(void)
Definition: Segment.h:81
T value_type
Definition: Segment.h:53
const T & end(void) const
Definition: Segment.h:86
T max(const T &a, const T &b, const T &c)
Definition: stl_utility.h:683
Segment(void)
default constructor
Definition: Segment.h:58
functor using compare
Definition: Segment.h:196
int compare_3way(const T &element, const Segment< T, Compare > &segment)
Definition: Segment.h:157
a class for a Segment or Interval
Definition: Segment.h:47
Segment< T, Compare > intersection(const Segment< T, Compare > &a, const Segment< T, Compare > &b)
Definition: Segment.h:178
int compare_3way(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Definition: Segment.h:138
bool operator()(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs) const
Definition: Segment.h:202
bool compare(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Definition: Segment.h:113
Segment(const T &begin, const T &end)
Constructor.
Definition: Segment.h:65
T & begin(void)
Definition: Segment.h:71