29 lines
554 B
C++
29 lines
554 B
C++
#pragma once
|
|
|
|
#include <compare>
|
|
#include <cstdint>
|
|
#include <stdexcept>
|
|
|
|
namespace fesa {
|
|
|
|
template <class Tag>
|
|
class EntityId final {
|
|
public:
|
|
explicit constexpr EntityId(const std::int64_t value) : value_{value} {
|
|
if (value < 0) {
|
|
throw std::invalid_argument{"EntityId value must not be negative."};
|
|
}
|
|
}
|
|
|
|
[[nodiscard]] constexpr std::int64_t value() const noexcept {
|
|
return value_;
|
|
}
|
|
|
|
auto operator<=>(const EntityId&) const = default;
|
|
|
|
private:
|
|
std::int64_t value_;
|
|
};
|
|
|
|
} // namespace fesa
|