11 #include <unordered_map>
26 throw std::logic_error(
"Unhandled type kind!");
41 const auto testType =
dynamic_cast<const TestType *
>(&other);
42 return testType && kind_ == testType->
kind_;
48 const auto typeHash =
typeid(
TestType).hash_code();
49 const auto kindHash = std::hash<TypeKind>()(
kind_);
59 std::shared_ptr<const TestType>
63 return std::shared_ptr<const TestType>(std::shared_ptr<void>(), &stateType);
66 std::shared_ptr<const TestType>
70 return std::shared_ptr<const TestType>(std::shared_ptr<void>(), &valueType);
~TestType() noexcept override
TypeKind Kind() const noexcept override
Return the kind of this type.
constexpr TestType(const TypeKind kind) noexcept
static std::shared_ptr< const TestType > createStateType()
static std::shared_ptr< const TestType > createValueType()
bool operator==(const Type &other) const noexcept override
std::size_t ComputeHash() const noexcept override
static std::string ToString(const TypeKind kind)
TypeKind
The kinds of types supported in rvsdg.
@ State
Designate a state type.
@ Value
Designate a value type.
static std::string strfmt(Args... args)
std::size_t CombineHashes(std::size_t hash, Args... args)