Next: Four Tuples ( four_tuple Up: Simple Data Types and Previous: Two Tuples ( two_tuple   Contents   Index

# Three Tuples ( three_tuple )

Definition

An instance p of type three_tuple<A,B,C> is a three-tuple (a, b, c) of variables of types A , B , and C , respectively.

Related types are two_tuple, three_tuple, and four_tuple.

#include < LEDA/core/tuple.h >

Types

 three_tuple< A,B,C> ::first_type the type of the first component. three_tuple< A,B,C> ::second_type the type of the second component. three_tuple< A,B,C> ::third_type the type of the third component.

Creation

 three_tuple< A,B,C> p creates an instance p of type three_tuple. All components are initialized to their default value. three_tuple< A,B,C> p(const A& u, const B& v, const C& w) creates an instance p of type three_tuple and initializes it with the value (u, v, w) .

Operations

 A& p.first() returns the A -component of p. If p is a const-object the return type is A . B& p.second() returns the B -component of p. If p is a const-object the return type is B . C& p.third() returns the C -component of p. If p is a const-object the return type is C . template < class A, class B, class C> bool const three_tuple< A,B,C> & p == const three_tuple< A,B,C> & q equality test for three_tuples. Each of the component types must have an equality operator. template < class A, class B, class C> int compare(const three_tuple< A,B,C> & p, const three_tuple< A,B,C> & q) lexicographic ordering for three_tuples. Each of the component types must have a compare function. template < class A, class B, class C> int Hash(const three_tuple< A,B,C> & p) hash function for three_tuples. Each of the component types must have a Hash function.

Implementation

The obvious implementation is used.

Next: Four Tuples ( four_tuple Up: Simple Data Types and Previous: Two Tuples ( two_tuple   Contents   Index
Christian Uhrig 2017-04-07