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.

3. Creation<br />

four tuple p;<br />

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

are initialized to their default value.<br />

four tuple p(const A& u, const B& v, const C& w, const D& x);<br />

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

it with the value (u, v, w, x).<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 />

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

return type is C.<br />

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

return type is D.<br />

template <br />

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

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

types must have an equality operator.<br />

template <br />

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

template <br />

int Hash(const four tuple& p)<br />

5. Implementation<br />

<strong>The</strong> obvious implementation is used.<br />

6. Example<br />

We customize four tuples and define a h array for them.<br />

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

types must have a compare function.<br />

hash function for four tuples. Each of the component<br />

types must have a Hash function.<br />

#define prio() first()<br />

#define inf() second()

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

Saved successfully!

Ooh no, something went wrong!