aboutsummaryrefslogtreecommitdiff
path: root/src/DI/object_type.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-09 22:52:21 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:55 +0200
commit09848ad31af6a1c70d64fccee711e231afb5a77f (patch)
tree734f69302959bfd6e0ac12fff1ac7f94b59a4190 /src/DI/object_type.cpp
parente0eaff89b5f3f289bf5d560ea64b969c90d32d18 (diff)
refactor: add error handling for the container get method
Diffstat (limited to 'src/DI/object_type.cpp')
-rw-r--r--src/DI/object_type.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/DI/object_type.cpp b/src/DI/object_type.cpp
index 60c7c78..f6004cb 100644
--- a/src/DI/object_type.cpp
+++ b/src/DI/object_type.cpp
@@ -1,17 +1,25 @@
#include "object_type.hpp"
-BaseObjectType::BaseObjectType(const std::type_info &type_info) : _type_info(type_info) {}
+BaseObjectType::BaseObjectType(const std::type_info &type_info) noexcept
+ : _type_info(type_info)
+{
+}
-bool BaseObjectType::operator==(const BaseObjectType &object_type) const
+bool BaseObjectType::operator==(const BaseObjectType &object_type) const noexcept
{
return hash() == object_type.hash();
}
-std::size_t BaseObjectType::hash() const
+std::size_t BaseObjectType::hash() const noexcept
{
return _type_info.hash_code();
}
+std::string_view BaseObjectType::name() const noexcept
+{
+ return std::string_view(_type_info.name());
+}
+
std::size_t ObjectTypeHasher::operator()(const BaseObjectType &object_type) const
{
return object_type.hash();