#include <yat/utility/Segment.h>
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) |
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..
typedef T theplu::yat::utility::Segment< T, Compare >::value_type |
type the Segment holds
theplu::yat::utility::Segment< T, Compare >::Segment | ( | const T & | begin, | |
const T & | end | |||
) | [inline] |
Constructor.
Creates a segment [begin, end)
const T& theplu::yat::utility::Segment< T, Compare >::begin | ( | void | ) | const [inline] |
T& theplu::yat::utility::Segment< T, Compare >::begin | ( | void | ) | [inline] |
const T& theplu::yat::utility::Segment< T, Compare >::end | ( | void | ) | const [inline] |
T& theplu::yat::utility::Segment< T, Compare >::end | ( | void | ) | [inline] |
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.
int compare_3way | ( | const T & | element, | |
const Segment< T, Compare > & | segment | |||
) | [related] |
int compare_3way | ( | const Segment< T, Compare > & | lhs, | |
const Segment< T, Compare > & | rhs | |||
) | [related] |
true
, +1 if compare(rhs, lhs) is true
, and 0 otherwiseSegment< T, Compare > intersection | ( | const Segment< T, Compare > & | a, | |
const Segment< T, Compare > & | b | |||
) | [related] |