summaryrefslogtreecommitdiffhomepage
path: root/entity
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-02-21 07:37:55 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-02-21 07:37:55 +0100
commit1cc674eda2d3002891f8fc5d91e4771c9de0eb1a (patch)
tree0b9a6d2441c9e9d95fe37e296834412608294437 /entity
parent12c36a35cf43d3453a5745e4464de531674e8e65 (diff)
entity: check field name
Diffstat (limited to 'entity')
-rw-r--r--entity/accessor.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/entity/accessor.hpp b/entity/accessor.hpp
index 9836b55f..3b979a16 100644
--- a/entity/accessor.hpp
+++ b/entity/accessor.hpp
@@ -62,10 +62,13 @@ struct erased_accessor final {
{}
template<typename T, typename FieldType>
- static constexpr bool check_name_static();
+ [[nodiscard]] static constexpr bool check_name_static();
template<typename T, typename FieldType>
- constexpr bool check_name() const noexcept;
+ [[nodiscard]] constexpr bool check_name() const noexcept;
+
+ template<typename FieldType>
+ [[nodiscard]] constexpr bool check_field_name() const noexcept;
template<typename Obj>
constexpr void do_asserts() const;
@@ -109,6 +112,13 @@ constexpr bool erased_accessor::check_name() const noexcept
obj == object_type && field == field_type;
}
+template<typename FieldType>
+constexpr bool erased_accessor::check_field_name() const noexcept
+{
+ constexpr auto name = name_of<FieldType>;
+ return field_name == name;
+}
+
template<typename Obj, typename FieldType>
constexpr void erased_accessor::assert_name() const noexcept
{