next up previous contents index
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/tuple.h >

Creation

three_tuple<A,B,C> p creates an instance p of type three_tuple<A,B,C>. All components are initialized to their default value.

three_tuple<A,B,C> p(A u, B v, C w) creates an instance p of type three_tuple<A,B,C> 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.

bool p == q equality test for three_tuples. Each of the component types must have an equality operator.

int compare(three_tuple<A,B,C> p, three_tuple<A,B,C> q)
    lexicographic ordering for three_tuples. Each of the component types must have a compare function.

int Hash(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 up previous contents index
Next: Four Tuples ( four_tuple Up: Simple Data Types and Previous: Two Tuples ( two_tuple   Contents   Index
LEDA research project
2000-02-09