summaryrefslogtreecommitdiff
path: root/c++/core/id.h
diff options
context:
space:
mode:
Diffstat (limited to 'c++/core/id.h')
-rw-r--r--c++/core/id.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/c++/core/id.h b/c++/core/id.h
new file mode 100644
index 0000000..f23d206
--- /dev/null
+++ b/c++/core/id.h
@@ -0,0 +1,30 @@
+#pragma once
+
+namespace saw {
+template<typename T>
+class id {
+private:
+ using type = uint64_t;
+
+ type value_;
+public:
+ id(type val):
+ value_{val}
+ {}
+
+ SAW_DEFAULT_COPY(id);
+ SAW_DEFAULT_MOVE(id);
+
+ bool operator==(const id<T>& rhs) const {
+ return value_ == rhs.value_;
+ }
+
+ bool operator!=(const id<T>& rhs) const {
+ return !(*this == rhs);
+ }
+
+ type get_value() const {
+ return value_;
+ }
+};
+}