diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-10-15 18:43:42 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-10-15 18:43:42 +0200 |
commit | 3f6197185bf8287c0b73b4fdd36e2a95606d6f69 (patch) | |
tree | d9ac1404f2d72a0c4ee6e30dac1cf41dabae062a /c++/core | |
parent | 28c83d509e8eedce08e8c12b4377aa33b3fc7d07 (diff) |
c++,core: Added ID
Diffstat (limited to 'c++/core')
-rw-r--r-- | c++/core/id.h | 30 |
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_; + } +}; +} |