diff --git a/TODO b/TODO index 3d130a86c..57308ca71 100644 --- a/TODO +++ b/TODO @@ -34,7 +34,6 @@ * use [[nodiscard]] consistently for safety purposes * make meta work across boundaries - - ::prop: use meta_any as arguments rather than sfinae all around - extend and make factory::prop more flexible - entt::reflect().type("foo"_hs, entt::as_property); or similar - forbid reflecting two times the same type diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index c19a9beb1..386f1d793 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -975,14 +975,11 @@ struct meta_ctor { /** * @brief Returns the property associated with a given key. - * @tparam Key Type of key to use to search for a property. * @param key The key to use to search for a property. * @return The property associated with the given key, if any. */ - template - std::enable_if_t, meta_prop> - prop(Key &&key) const ENTT_NOEXCEPT { - return internal::find_if([key = meta_any{std::forward(key)}](auto *candidate) { + meta_prop prop(meta_any key) const ENTT_NOEXCEPT { + return internal::find_if([key = std::move(key)](auto *candidate) { return candidate->key() == key; }, node->prop); } @@ -1178,14 +1175,11 @@ struct meta_data { /** * @brief Returns the property associated with a given key. - * @tparam Key Type of key to use to search for a property. * @param key The key to use to search for a property. * @return The property associated with the given key, if any. */ - template - std::enable_if_t, meta_prop> - prop(Key &&key) const ENTT_NOEXCEPT { - return internal::find_if([key = meta_any{std::forward(key)}](auto *candidate) { + meta_prop prop(meta_any key) const ENTT_NOEXCEPT { + return internal::find_if([key = std::move(key)](auto *candidate) { return candidate->key() == key; }, node->prop); } @@ -1314,14 +1308,11 @@ struct meta_func { /** * @brief Returns the property associated with a given key. - * @tparam Key Type of key to use to search for a property. * @param key The key to use to search for a property. * @return The property associated with the given key, if any. */ - template - std::enable_if_t, meta_prop> - prop(Key &&key) const ENTT_NOEXCEPT { - return internal::find_if([key = meta_any{std::forward(key)}](auto *candidate) { + meta_prop prop(meta_any key) const ENTT_NOEXCEPT { + return internal::find_if([key = std::move(key)](auto *candidate) { return candidate->key() == key; }, node->prop); } @@ -1711,14 +1702,11 @@ public: * means that the properties of the base classes will also be inspected, if * any. * - * @tparam Key Type of key to use to search for a property. * @param key The key to use to search for a property. * @return The property associated with the given key, if any. */ - template - std::enable_if_t, meta_prop> - prop(Key &&key) const ENTT_NOEXCEPT { - return internal::find_if<&internal::meta_type_node::prop>([key = meta_any{std::forward(key)}](auto *candidate) { + meta_prop prop(meta_any key) const ENTT_NOEXCEPT { + return internal::find_if<&internal::meta_type_node::prop>([key = std::move(key)](auto *candidate) { return candidate->key() == key; }, node); }