1 #ifndef theplu_yat_utility_segment 2 #define theplu_yat_utility_segment 26 #include "yat_assert.h" 47 template<
typename T,
class Compare = std::less<T> >
67 : begin_(begin), end_(end) {}
72 T&
begin(
void) {
return begin_; }
77 const T&
begin(
void)
const {
return begin_; }
82 T&
end(
void) {
return end_; }
87 const T&
end(
void)
const {
return end_; }
125 template<
typename T,
class Compare>
131 || comp(lhs.
end(), rhs.
end()) || comp(rhs.
end(), lhs.
end());
144 template<
typename T,
class Compare>
167 template<
typename T,
class Compare>
172 YAT_ASSERT(!c(lhs.
end(), lhs.
begin()));
173 YAT_ASSERT(!c(rhs.
end(), rhs.
begin()));
192 template<
typename T,
class Compare>
211 template<
typename T,
class Compare>
216 if (comp(element, segment.
begin()))
218 if (comp(element, segment.
end()))
230 template<
typename T,
class Compare>
246 template<
typename T,
class Compare>
256 std::min(a.
end(), b.
end(), comp),
275 template<
typename T,
class Compare>
293 template<
typename T,
class Compare>
310 template<
typename T,
class Compare>
321 template<
typename T,
class Compare>
323 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:294
const T & begin(void) const
Definition: Segment.h:77
The Department of Theoretical Physics namespace as we define it.
T & end(void)
Definition: Segment.h:82
T value_type
Definition: Segment.h:54
Segment< T, Compare > set_union(const Segment< T, Compare > &a, const Segment< T, Compare > &b)
union of two segments
Definition: Segment.h:276
const T & end(void) const
Definition: Segment.h:87
Segment< T > make_segment(T first, T last)
Definition: Segment.h:105
T max(const T &a, const T &b, const T &c)
Definition: stl_utility.h:699
Segment(void)
default constructor
Definition: Segment.h:59
functor using compare
Definition: Segment.h:322
int compare_3way(const T &element, const Segment< T, Compare > &segment)
Definition: Segment.h:212
a class for a Segment or Interval
Definition: Segment.h:48
bool operator==(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Definition: Segment.h:145
Segment< T, Compare > intersection(const Segment< T, Compare > &a, const Segment< T, Compare > &b)
Definition: Segment.h:247
int compare_3way(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Definition: Segment.h:193
bool operator()(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs) const
Definition: Segment.h:328
bool operator!=(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Inequality operator.
Definition: Segment.h:126
bool compare(const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs)
Definition: Segment.h:168
Segment(const T &begin, const T &end)
Constructor.
Definition: Segment.h:66
T & begin(void)
Definition: Segment.h:72
bool overlap(const yat::utility::Segment< T, Compare > &lhs, const yat::utility::Segment< T, Compare > &rhs)
Definition: Segment.h:311
int compare_3way(const Segment< T, Compare > &segment, const T &element)
Definition: Segment.h:231