46 template<
class E1,
class E2>
class Tuple2 {
54 Tuple2(
const E1 &y1,
const E2 &y2) : m_x1(y1), m_x2(y2) { }
59 const E1 &
x1()
const {
return m_x1; }
61 const E2 &
x2()
const {
return m_x2; }
75 template<
class E1,
class E2>
78 return t1.
x1() == t2.
x1() && t1.
x2() == t2.
x2();
82 template<
class E1,
class E2>
85 return t1.
x1() != t2.
x1() || t1.
x2() != t2.
x2();
89 template<
class E1,
class E2>
90 std::ostream &operator<<(std::ostream &os, const Tuple2<E1,E2> &t2)
92 os <<
"(" << t2.x1() <<
" " << t2.x2() <<
")";
98 template<
typename K1_,
typename K2_,
107 : m_hash1(hash1), m_hash2(hash2) { }
110 return 23*m_hash1.hash(key.
x1()) + 443*m_hash2.hash(key.
x2());
Tuple2()
Constructs a 2-tuple using default constructors.
E1 & x1()
Returns a reference the first element.
Declaration of classes used for hashing.
E2 & x2()
Returns a reference the second element.
E2 m_x2
The second element.
size_t hash(const Tuple2< K1_, K2_ > &key) const
Tuple2(const Tuple2< E1, E2 > &t2)
Constructs a 2-tuple that is a copy of t2.
Tuples of two elements (2-tuples).
const E1 & x1() const
Returns a reference the first element.
E1 m_x1
The first element.
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
HashFuncTuple(const Hash1_ &hash1, const Hash2_ &hash2)
const E2 & x2() const
Returns a reference the second element.
Basic declarations, included by all source files.
Tuple2(const E1 &y1, const E2 &y2)
Constructs a 2-tuple for given values.
The namespace for all OGDF objects.
bool operator==(const Tuple2< E1, E2 > &t1, const Tuple2< E1, E2 > &t2)
Equality operator for 2-tuples.
bool operator!=(const Tuple2< E1, E2 > &t1, const Tuple2< E1, E2 > &t2)
Inequality operator for 2-tuples.
Tuple2 & operator=(const Tuple2< E1, E2 > &)=default