From 3f6197185bf8287c0b73b4fdd36e2a95606d6f69 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 15 Oct 2023 18:43:42 +0200 Subject: c++,core: Added ID --- c++/core/id.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 c++/core/id.h (limited to 'c++/core/id.h') 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 +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& rhs) const { + return value_ == rhs.value_; + } + + bool operator!=(const id& rhs) const { + return !(*this == rhs); + } + + type get_value() const { + return value_; + } +}; +} -- cgit v1.2.3