Przeglądaj źródła

helper: suppress a warning from the linter (waiting for C++20)

Michele Caini 11 miesięcy temu
rodzic
commit
21ac61abbc
2 zmienionych plików z 3 dodań i 4 usunięć
  1. 1 0
      TODO
  2. 2 4
      src/entt/entity/helper.hpp

+ 1 - 0
TODO

@@ -10,6 +10,7 @@ DOC:
 * bump entities, reserved bits on identifiers
 
 TODO:
+* review all NOLINT
 * bring nested groups back in place (see bd34e7f)
 * work stealing job system (see #100) + mt scheduler based on const awareness for types
 * view: reduce inst due to/improve perf with index-based approach in dispatch_get/pick_and_each/each (single type too, define storage ::at and ::at_as_tuple)

+ 2 - 4
src/entt/entity/helper.hpp

@@ -126,17 +126,15 @@ template<typename... Args>
 typename basic_storage<Args...>::entity_type to_entity(const basic_storage<Args...> &storage, const typename basic_storage<Args...>::value_type &instance) {
     using traits_type = component_traits<typename basic_storage<Args...>::value_type, typename basic_storage<Args...>::entity_type>;
     static_assert(traits_type::page_size != 0u, "Unexpected page size");
-
-
-
-
     const auto *page = storage.raw();
 
+    // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic)
     for(std::size_t pos{}, count = storage.size(); pos < count; pos += traits_type::page_size, ++page) {
         if(const auto dist = (std::addressof(instance) - *page); dist >= 0 && dist < static_cast<decltype(dist)>(traits_type::page_size)) {
             return *(static_cast<const typename basic_storage<Args...>::base_type &>(storage).rbegin() + static_cast<decltype(dist)>(pos) + dist);
         }
     }
+    // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic)
 
     return null;
 }