next up previous contents index
Next: Four Tuples ( four_tuple Up: Simple Data Types Previous: Two Tuples ( two_tuple

     
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 >

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<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.

template <class A, class B, class C>
bool p == 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(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.

template <class A, class B, class C>
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 Previous: Two Tuples ( two_tuple

© Copyright 1995-2002, Algorithmic Solutions Software GmbH. All rights reserved.
2002-10-16