-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContact.cpp
More file actions
42 lines (33 loc) · 1.14 KB
/
Contact.cpp
File metadata and controls
42 lines (33 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "Contact.h"
void Contact::randomize() {
m_id.uniformRandomize();
}
bool Contact::operator == (const Contact & otherContact) const
{
return std::tie(m_id, m_endpoint) == std::tie(otherContact.m_id, otherContact.m_endpoint);
}
bool Contact::operator != (const Contact & otherContact) const
{
return !(std::tie(m_id, m_endpoint) == std::tie(otherContact.m_id, otherContact.m_endpoint));
}
bool Contact::operator < (const Contact & otherContact) const
{
return std::tie(m_id, m_endpoint) < std::tie(otherContact.m_id, otherContact.m_endpoint);
}
bool Contact::operator <= (const Contact & otherContact) const
{
return std::tie(m_id, m_endpoint) <= std::tie(otherContact.m_id, otherContact.m_endpoint);
}
bool Contact::operator > (const Contact & otherContact) const
{
return std::tie(otherContact.m_id, otherContact.m_endpoint) < std::tie(m_id, m_endpoint);
}
bool Contact::operator >= (const Contact & otherContact) const
{
return std::tie(otherContact.m_id, otherContact.m_endpoint) <= std::tie(m_id, m_endpoint);
}
std::ostream& operator<<(std::ostream& out, const Contact& c)
{
out << c.m_id;
return out;
}