-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTableEntry.h
41 lines (32 loc) · 925 Bytes
/
TableEntry.h
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
#ifndef TABLEENTRY_H
#define TABLEENTRY_H
#include <string>
#include <ostream>
template <typename V>
class TableEntry {
public:
std::string key;
V value;
TableEntry(std::string key, V value) : key{key} , value{value} {}
TableEntry(std::string key) : key{key} {}
TableEntry(){
key = "";
}
friend bool operator==(const TableEntry<V> &te1, const TableEntry<V> &te2){
return te1.key == te2.key;
}
friend bool operator!=(const TableEntry<V> &te1, const TableEntry<V> &te2){
return te1.key != te2.key;
}
friend std::ostream& operator<<(std::ostream &out, const TableEntry<V> &te){
out << "\nKey: " << te.key << " ,Value: " << te.value;
return out;
}
friend bool operator<(const TableEntry<V> &te1, const TableEntry<V> &te2){
return te1.key < te2.key;
}
friend bool operator>(const TableEntry<V> &te1, const TableEntry<V> &te2){
return te1.key > te2.key;
}
};
#endif