From 1cc674eda2d3002891f8fc5d91e4771c9de0eb1a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 21 Feb 2023 07:37:55 +0100 Subject: entity: check field name --- entity/accessor.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'entity') 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 - static constexpr bool check_name_static(); + [[nodiscard]] static constexpr bool check_name_static(); template - constexpr bool check_name() const noexcept; + [[nodiscard]] constexpr bool check_name() const noexcept; + + template + [[nodiscard]] constexpr bool check_field_name() const noexcept; template constexpr void do_asserts() const; @@ -109,6 +112,13 @@ constexpr bool erased_accessor::check_name() const noexcept obj == object_type && field == field_type; } +template +constexpr bool erased_accessor::check_field_name() const noexcept +{ + constexpr auto name = name_of; + return field_name == name; +} + template constexpr void erased_accessor::assert_name() const noexcept { -- cgit v1.2.3