Sfoglia il codice sorgente

config/component: ENTT_IGNORE_IF_EMPTY -> ENTT_ETO_TYPE

Michele Caini 3 anni fa
parent
commit
56921d6449
3 ha cambiato i file con 5 aggiunte e 9 eliminazioni
  1. 0 1
      TODO
  2. 4 2
      src/entt/config/config.h
  3. 1 6
      src/entt/entity/component.hpp

+ 0 - 1
TODO

@@ -11,7 +11,6 @@ DOC:
 * examples (and credits) from @alanjfs :)
 
 WIP:
-* make utilities page_size and in_place_delete public
 * emitter: runtime handlers, allocator support (ready for both already)
 * view/group: no storage_traits dependency -> use storage instead of components for the definition
 * basic_storage::bind for cross-registry setups

+ 4 - 2
src/entt/config/config.h

@@ -48,8 +48,10 @@
 #    define ENTT_ASSERT(condition, ...) assert(condition)
 #endif
 
-#ifndef ENTT_NO_ETO
-#    define ENTT_IGNORE_IF_EMPTY
+#ifdef ENTT_NO_ETO
+#    define ENTT_ETO_TYPE(Type) void
+#else
+#    define ENTT_ETO_TYPE(Type) Type
 #endif
 
 #ifdef ENTT_STANDARD_CPP

+ 1 - 6
src/entt/entity/component.hpp

@@ -21,13 +21,8 @@ template<typename Type>
 struct in_place_delete<Type, std::enable_if_t<Type::in_place_delete>>
     : std::true_type {};
 
-#if defined ENTT_IGNORE_IF_EMPTY
 template<typename Type, typename = void>
-struct page_size: std::integral_constant<std::size_t, !std::is_empty_v<Type> * ENTT_PACKED_PAGE> {};
-#else
-template<typename Type, typename = void>
-struct page_size: std::integral_constant<std::size_t, ENTT_PACKED_PAGE> {};
-#endif
+struct page_size: std::integral_constant<std::size_t, !std::is_empty_v<ENTT_ETO_TYPE(Type)> * ENTT_PACKED_PAGE> {};
 
 template<typename Type>
 struct page_size<Type, std::enable_if_t<std::is_convertible_v<decltype(Type::page_size), std::size_t>>>