-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentry.h
40 lines (34 loc) · 1.08 KB
/
entry.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
#ifndef _ENTRY_H_
#define _ENTRY_H_
#include <stdio.h>
namespace amo {
#define RESET "\033[0m"
#define BLACK "\033[30m" /* Black */
#define RED "\033[31m" /* Red */
#define GREEN "\033[32m" /* Green */
#define YELLOW "\033[33m" /* Yellow */
#define BLUE "\033[34m" /* Blue */
#define MAGENTA "\033[35m" /* Magenta */
#define CYAN "\033[36m" /* Cyan */
#define WHITE "\033[37m" /* White */
template<typename K, typename V>
class Entry {
private:
public:
K key;
V val;
Entry(K k = K(), V v = V()): key(k), val(v) {};
Entry(Entry<K, V> const& e): key(e.key), val(e.val) {};
~Entry() {};
bool operator<(Entry<K, V> const& e) {return key < e.key;}
bool operator>(Entry<K, V> const& e) {return key > e.key;}
bool operator==(Entry<K, V> const& e) {return key == e.key;}
bool operator!=(Entry<K, V> const& e) {return key != e.key;}
friend std::ostream& operator<<(std::ostream& os, const Entry<K, V>& entry) {
os << "[" << entry.key;
os << "/" << entry.val << "] ";
return os;
}
};
};
#endif