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

stl: std::is_trivially_destructible_v

skypjack 20 часов назад
Родитель
Сommit
cf7199e83e
3 измененных файлов с 6 добавлено и 5 удалено
  1. 2 2
      src/entt/core/any.hpp
  2. 3 3
      src/entt/entity/storage.hpp
  3. 1 0
      src/entt/stl/type_traits.hpp

+ 2 - 2
src/entt/core/any.hpp

@@ -112,7 +112,7 @@ class basic_any: private internal::basic_any_storage<Len, Align> {
 
     template<cvref_unqualified Type>
     static void basic_deleter(const basic_any &value) {
-        ENTT_ASSERT((value.mode == any_policy::dynamic) || ((value.mode == any_policy::embedded) && !std::is_trivially_destructible_v<Type>), "Unexpected policy");
+        ENTT_ASSERT((value.mode == any_policy::dynamic) || ((value.mode == any_policy::embedded) && !stl::is_trivially_destructible_v<Type>), "Unexpected policy");
 
         const auto *elem = static_cast<const Type *>(value.data());
 
@@ -143,7 +143,7 @@ class basic_any: private internal::basic_any_storage<Len, Align> {
             // NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
             this->instance = (std::addressof(args), ...);
         } else if constexpr(in_situ_v<plain_type>) {
-            if constexpr(std::is_trivially_destructible_v<plain_type>) {
+            if constexpr(stl::is_trivially_destructible_v<plain_type>) {
                 deleter = nullptr;
             } else {
                 deleter = &basic_deleter<plain_type>;

+ 3 - 3
src/entt/entity/storage.hpp

@@ -260,7 +260,7 @@ class basic_storage: public basic_sparse_set<Entity, typename std::allocator_tra
         const auto from = (sz + traits_type::page_size - 1u) / traits_type::page_size;
         allocator_type allocator{get_allocator()};
 
-        if constexpr(!std::is_trivially_destructible_v<element_type>) {
+        if constexpr(!stl::is_trivially_destructible_v<element_type>) {
             for(auto pos = sz, length = base_type::size(); pos < length; ++pos) {
                 if constexpr(traits_type::in_place_delete) {
                     if(base_type::data()[pos] != tombstone) {
@@ -325,7 +325,7 @@ protected:
             if constexpr(traits_type::in_place_delete) {
                 base_type::in_place_pop(*first);
                 alloc_traits::destroy(allocator, std::addressof(elem));
-            } else if constexpr(std::is_trivially_destructible_v<element_type>) {
+            } else if constexpr(stl::is_trivially_destructible_v<element_type>) {
                 elem = stl::move(element_at(base_type::size() - 1u));
                 base_type::swap_and_pop(*first);
             } else {
@@ -340,7 +340,7 @@ protected:
 
     /*! @brief Erases all entities of a storage. */
     void pop_all() override {
-        if constexpr(std::is_trivially_destructible_v<element_type>) {
+        if constexpr(stl::is_trivially_destructible_v<element_type>) {
             base_type::pop_all();
         } else {
             allocator_type allocator{get_allocator()};

+ 1 - 0
src/entt/stl/type_traits.hpp

@@ -13,6 +13,7 @@ using std::is_lvalue_reference_v;
 using std::is_member_object_pointer_v;
 using std::is_pointer_v;
 using std::is_same_v;
+using std::is_trivially_destructible_v;
 using std::is_void_v;
 using std::remove_cvref_t;
 using std::remove_pointer_t;