a class for a Segment or Interval
More...
#include <yat/utility/Segment.h>
List of all members.
Public Types |
typedef T | value_type |
Public Member Functions |
| Segment (void) |
| default constructor
|
| Segment (const T &begin, const T &end) |
| Constructor.
|
T & | begin (void) |
const T & | begin (void) const |
T & | end (void) |
const T & | end (void) const |
Related Functions |
(Note that these are not member functions.)
|
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 > |
Segment< T, Compare > | intersection (const Segment< T, Compare > &a, const Segment< T, Compare > &b) |
Detailed Description
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
Member Typedef Documentation
template<typename T, class Compare = std::less<T>>
Constructor & Destructor Documentation
template<typename T, class Compare = std::less<T>>
Constructor.
Creates a segment [begin, end)
Member Function Documentation
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
Friends And Related Function Documentation
template<typename T , class Compare >
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.
template<typename T , class Compare >
- Returns:
- -1 if compare(lhs, rhs) is
true
, +1 if compare(rhs, lhs) is true
, and 0 otherwise
\see compare(const Segment<T, Compare>&, const Segment<T, Compare>&)
\since new in yat 0.7
template<typename T , class Compare >
- Returns:
- -1 if element is less than all elements in segment, 0 if element overlaps with segment, and 1 otherwise.
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.
The documentation for this class was generated from the following file: