feat(solver-bootstrap): step 3 — core-ids-and-diagnostics
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user