Просмотр исходного кода

registry: remove [[nodiscard]] from the template ::storage method

Michele Caini 4 лет назад
Родитель
Сommit
e6006663ec
2 измененных файлов с 4 добавлено и 4 удалено
  1. 2 2
      src/entt/entity/registry.hpp
  2. 2 2
      test/entt/entity/registry.cpp

+ 2 - 2
src/entt/entity/registry.hpp

@@ -413,7 +413,7 @@ public:
      * @return The storage for the given component type.
      */
     template<typename Component>
-    [[nodiscard]] decltype(auto) storage(const id_type id = type_hash<Component>::value()) {
+    decltype(auto) storage(const id_type id = type_hash<Component>::value()) {
         return assure<Component>(id);
     }
 
@@ -429,7 +429,7 @@ public:
      * @return The storage for the given component type.
      */
     template<typename Component>
-    [[nodiscard]] decltype(auto) storage(const id_type id = type_hash<Component>::value()) const {
+    decltype(auto) storage(const id_type id = type_hash<Component>::value()) const {
         return assure<Component>(id);
     }
 

+ 2 - 2
test/entt/entity/registry.cpp

@@ -1873,8 +1873,8 @@ TEST(Registry, RuntimePools) {
     static_assert(std::is_same_v<decltype(registry.storage("other"_hs)->second), typename entt::storage_traits<entt::entity, empty_type>::storage_type::base_type &>);
     static_assert(std::is_same_v<decltype(std::as_const(registry).storage("other"_hs)->second), const typename entt::storage_traits<entt::entity, empty_type>::storage_type::base_type &>);
 
-    ASSERT_DEATH([[maybe_unused]] auto &&unused = registry.storage<int>("other"_hs), "");
-    ASSERT_DEATH([[maybe_unused]] auto &&unused = std::as_const(registry).storage<int>("other"_hs), "");
+    ASSERT_DEATH(auto &&unused = registry.storage<int>("other"_hs), "");
+    ASSERT_DEATH(auto &&unused = std::as_const(registry).storage<int>("other"_hs), "");
 
     ASSERT_NE(registry.storage("other"_hs), registry.storage().end());
     ASSERT_EQ(std::as_const(registry).storage("rehto"_hs), registry.storage().end());