31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.18 Two Tuples ( two tuple )<br />

1. Definition<br />

An instance p of type two tuple is a two-tuple (a, b) of variables of types A, and<br />

B, respectively.<br />

Related types are two tuple, three tuple, and four tuple.<br />

#include < <strong>LEDA</strong>/core/tuple.h ><br />

2. Types<br />

two tuple:: first type the type of the first component.<br />

two tuple:: second type<br />

3. Creation<br />

the type of the second component.<br />

two tuple p;<br />

creates an instance p of type two tuple. All components<br />

are initialized to their default value.<br />

two tuple p(const A& u, const B& v);<br />

creates an instance p of type two tuple and initializes<br />

it with the value (u, v).<br />

4. Operations<br />

A& p.first( ) returns the A-component of p. If p is a const-object the<br />

return type is A.<br />

B& p.second( ) returns the B-component of p. If p is a const-object the<br />

return type is B.<br />

template <br />

bool const two tuple& p == const two tuple& q<br />

equality test for two tuples. Each of the component<br />

types must have an equality operator.<br />

template <br />

int compare(const two tuple& p, const two tuple& q)<br />

template <br />

lexicographic ordering for two tuples. Each of the component<br />

types must have a compare function.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!