-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitem.hpp
43 lines (32 loc) · 785 Bytes
/
item.hpp
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
42
43
#include <iostream>
#ifndef ITEM_HPP
#define ITEM_HPP
class Item
{
public:
Item();
explicit Item(int key, unsigned long long val, char opcode);
~Item();
friend std::ostream &operator<<(std::ostream &os, const Item &item);
friend std::istream &operator>>(std::istream &in, Item &item);
int key;
unsigned long long val;
char opcode;
};
// Implementation start
Item::Item() {}
Item::Item(int key, unsigned long long val, char opcode) : key(key), val(val), opcode(opcode)
{
}
Item::~Item() {}
std::istream &operator>>(std::istream &in, Item &item)
{
in >> item.key >> item.val >> item.opcode;
return in;
}
std::ostream &operator<<(std::ostream &os, const Item &item)
{
os << item.key << ' ' << item.val << ' ' << item.opcode << '\n';
return os;
}
#endif // ITEM_HPP