CGAL 4.12 - STL Extensions for CGAL
|
#include <CGAL/utility.h>
The Triple class is an extension of std::pair
.
Triple
is a heterogeneous triple: it holds one object of type T1
, one of type T2
, and one of type T3
. A Triple
is much like a container, in that it "owns" its elements. It is not actually a model of container, though, because it does not support the standard methods (such as iterators) for accessing the elements of a container.
CGAL::cpp11::tuple
or CGAL::cpp11::array
instead for new uses.
Requirements
T1
, T2
and T3
must be Assignable
. Additional operations have additional requirements.
Public Member Functions | |
template<class T1 , class T2 , class T3 > | |
bool | operator< (Triple< T1, T2, T3 > x, Triple< T1, T2, T3 > y) |
The comparison operator. More... | |
template<class T1 , class T2 , class T3 > | |
bool | operator== (Triple< T1, T2, T3 > x, Triple< T1, T2, T3 > y) |
The equality operator. More... | |
Types | |
typedef T1 | first_type |
typedef T2 | second_type |
typedef T3 | third_type |
Variables | |
T1 | first |
first element. More... | |
T2 | second |
second element. More... | |
T3 | third |
third element. More... | |
Creation | |
Triple () | |
introduces a triple using the default constructor of the three elements. | |
Triple (T1 x, T2 y, T3 z) | |
constructs a triple such that first is constructed from x , second is constructed from y , and third is constructed from z . | |
template<class U , class V , class W > | |
Triple (U u, V v, W w) | |
constructs a triple such that first is constructed from u , second is constructed from v , and third is constructed from w . More... | |
template<int i> | |
T | get () |
Gives access to first , second or third whenever i is 0, 1 or 2, via a, potentially const, reference. More... | |
CGAL::Triple< T1, T2, T3 >::Triple | ( | U | u, |
V | v, | ||
W | w | ||
) |
constructs a triple such that first
is constructed from u
, second
is constructed from v
, and third
is constructed from w
.
Proper conversion operators must exist from U
to T1
, V
to T2
, and W
to T3
.
T CGAL::Triple< T1, T2, T3 >::get | ( | ) |
Gives access to first
, second
or third
whenever i
is 0, 1 or 2, via a, potentially const, reference.
Note: T
stands for T1
, T2
or T3
depending on i
.
bool CGAL::Triple< T1, T2, T3 >::operator< | ( | Triple< T1, T2, T3 > | x, |
Triple< T1, T2, T3 > | y | ||
) |
The comparison operator.
It uses lexicographic comparison: the return value is true if the first element of x
is less than the first element of y
, and false if the first element of y
is less than the first element of x
. If neither of these is the case, then it returns true if the second element of x
is less than the second element of y
, and false if the second element of y
is less than the second element of x
. If neither of these is the case, then it returns the result of comparing the third elements of x
and y
. This operator may only be used if T1
, T2
and T3
define the comparison operator.
bool CGAL::Triple< T1, T2, T3 >::operator== | ( | Triple< T1, T2, T3 > | x, |
Triple< T1, T2, T3 > | y | ||
) |
The equality operator.
The return value is true if and only the first elements of x
and y
are equal, the second elements of x
and y
are equal, and the third elements of x
and y
are equal. This operator may only be used if T1
, T2
and T3
define the equality operator.
T1 CGAL::Triple< T1, T2, T3 >::first |
first element.
Please access it using get<0>()
.
T2 CGAL::Triple< T1, T2, T3 >::second |
second element.
Please access it using get<1>()
.
T3 CGAL::Triple< T1, T2, T3 >::third |
third element.
Please access it using get<2>()
.