a class for a Segment or Interval
More...
#include <yat/utility/Segment.h>
|
(Note that these are not member functions.)
|
template<typename T , class Compare > |
bool | operator!= (const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs) |
| Inequality operator. More...
|
|
template<typename T , class Compare > |
bool | operator== (const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs) |
|
template<typename T , class Compare > |
bool | compare (const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs) |
|
template<typename T , class Compare > |
int | compare_3way (const Segment< T, Compare > &lhs, const Segment< T, Compare > &rhs) |
|
template<typename T , class Compare > |
int | compare_3way (const T &element, const Segment< T, Compare > &segment) |
|
template<typename T , class Compare > |
int | compare_3way (const Segment< T, Compare > &segment, const T &element) |
|
template<typename T , class Compare > |
Segment< T, Compare > | intersection (const Segment< T, Compare > &a, const Segment< T, Compare > &b) |
|
template<typename T, class Compare = std::less<T>>
class theplu::yat::utility::Segment< T, Compare >
a class for a Segment or Interval
A Segment is defined by its begin and end. The end is not included in the Segment, i.e., you could write the Segment as [begin, end). Type T must be comparable, optionally with a comparator Compare, which should implement Strict Weak Ordering..
- Since
- new in yat 0.7
template<typename T, class Compare = std::less<T>>
template<typename T, class Compare = std::less<T>>
Constructor.
Creates a segment [begin, end)
template<typename T, class Compare = std::less<T>>
- Returns
- reference to first element in Segment
template<typename T, class Compare = std::less<T>>
- Returns
- const reference to first element in Segment
template<typename T, class Compare = std::less<T>>
- Returns
- reference to first element greater than Segment
template<typename T, class Compare = std::less<T>>
- Returns
- const reference to first element greater than Segment
template<typename T , class Compare >
bool compare |
( |
const Segment< T, Compare > & |
lhs, |
|
|
const Segment< T, Compare > & |
rhs |
|
) |
| |
|
related |
This function takes two Segment and compare them with comparator Compare. If all elements in lhs is less than all elements in rhs, true
is returned. In other words, false
is returned if rhs.begin() is less than lhs.end().
The exception is if both lhs and rhs are empty Segment (i.e. begin equals end) and their begins and ends are equal, in which case false
is returned. This exception implies that compare(x,x) always returns false.
- Since
- new in yat 0.7
template<typename T , class Compare >
int compare_3way |
( |
const Segment< T, Compare > & |
lhs, |
|
|
const Segment< T, Compare > & |
rhs |
|
) |
| |
|
related |
template<typename T , class Compare >
int compare_3way |
( |
const T & |
element, |
|
|
const Segment< T, Compare > & |
segment |
|
) |
| |
|
related |
- Returns
- -1 if element is less than all elements in segment, 0 if element overlaps with segment, and 1 otherwise.
- Since
- new in yat 0.7
template<typename T , class Compare >
int compare_3way |
( |
const Segment< T, Compare > & |
segment, |
|
|
const T & |
element |
|
) |
| |
|
related |
- Returns
- -1 if all elements in segment are less than element, 0 if if element overlaps with segment, and 1 otherwise.
- Since
- new in yat 0.14
template<typename T , class Compare >
- Returns
- intersection of a and b. If a and b do not overlap an empty Section is returned (begin==end), but the exact value of begin is undefined.
- Since
- new in yat 0.7
template<typename T , class Compare >
bool operator!= |
( |
const Segment< T, Compare > & |
lhs, |
|
|
const Segment< T, Compare > & |
rhs |
|
) |
| |
|
related |
Inequality operator.
Inequality operator is defined via the operator< of T or in the general case Compare.
- Returns
- true if Compare returns true for either when comparing lhs.begin() and rhs.begin() or when comparing lhs.end() and rhs.end().
- Since
- New in yat 0.14
template<typename T , class Compare >
bool operator== |
( |
const Segment< T, Compare > & |
lhs, |
|
|
const Segment< T, Compare > & |
rhs |
|
) |
| |
|
related |
- Returns
- true if Compare returns false when comparing lhs.begin() and rhs.begin() as well as when comparing lhs.end() and rhs.end().
- Since
- New in yat 0.14
The documentation for this class was generated from the following file: