-
Notifications
You must be signed in to change notification settings - Fork 1
/
id.h
32 lines (21 loc) · 536 Bytes
/
id.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
#ifndef ID_H
#define ID_H
#include <iosfwd>
/// An ID, each one being unique
class id
{
public:
int get() const noexcept { return m_value; }
private:
id();
static int sm_next_value;
int m_value;
friend id create_new_id() noexcept;
};
id create_new_id() noexcept;
/// Test this class and its free functions
void test_id();
bool operator==(const id& lhs, const id& rhs) noexcept;
bool operator!=(const id& lhs, const id& rhs) noexcept;
std::ostream& operator<<(std::ostream& os, const id& i) noexcept;
#endif // ID_H