blob: 5107dbfdc19b27b7a9e5e44e33a6b2556886fdc1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#pragma once
#include <string_view>
#include <typeinfo>
class BaseObjectType
{
public:
explicit BaseObjectType(const std::type_info &type_info) noexcept;
auto operator==(const BaseObjectType &object_type) const noexcept -> bool;
[[nodiscard]] auto hash() const noexcept -> std::size_t;
[[nodiscard]] auto name() const noexcept -> std::string_view;
private:
const std::type_info &_type_info;
};
template <class Object>
class ObjectType : public BaseObjectType
{
public:
ObjectType() noexcept : BaseObjectType(typeid(Object)) {}
};
class ObjectTypeHasher
{
public:
auto operator()(const BaseObjectType &object_type) const noexcept -> std::size_t;
};
|