소스 검색

Remove std::is_pod from AzCore (#15892)

* Update AZStdContainers.inl

Replaced uses of deprecated std::is_pod trait with std::is_trivial as described in issue #11627

Signed-off-by: ajv4288 <[email protected]>

* Delete is_pod.h

Removed is_pod.h file from AzCore as described in issue #11627

Signed-off-by: ajv4288 <[email protected]>

* Merged latest and removed deleted file from cmake

Signed-off-by: Luis Sempé <[email protected]>

* Removed included deleted file

Signed-off-by: Luis Sempé <[email protected]>

* Replaced uses of is_pod with is_trivial

Signed-off-by: Luis Sempé <[email protected]>

---------

Signed-off-by: ajv4288 <[email protected]>
Signed-off-by: Luis Sempé <[email protected]>
Co-authored-by: Luis Sempé <[email protected]>
ajv4288 5 달 전
부모
커밋
fc51a12a7b

+ 1 - 1
Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp

@@ -2332,7 +2332,7 @@ LUA_API const Node* lua_getDummyNode()
             template<class T>
             template<class T>
             bool AllocateTempStorageLuaNative(BehaviorArgument& value, BehaviorClass* valueClass, ScriptContext::StackVariableAllocator& tempAllocator, AZStd::allocator* backupAllocator = nullptr)
             bool AllocateTempStorageLuaNative(BehaviorArgument& value, BehaviorClass* valueClass, ScriptContext::StackVariableAllocator& tempAllocator, AZStd::allocator* backupAllocator = nullptr)
             {
             {
-                static_assert(AZStd::is_pod<T>::value, "This should be use only for POD data types, as no ctor/dtor is called!");
+                static_assert(AZStd::is_trivial<T>::value, "This should be use only for trivial data types, as no ctor/dtor is called!");
                 (void)valueClass;
                 (void)valueClass;
 
 
                 if (value.m_traits & BehaviorParameter::TR_POINTER)
                 if (value.m_traits & BehaviorParameter::TR_POINTER)

+ 2 - 2
Code/Framework/AzCore/AzCore/Serialization/AZStdContainers.inl

@@ -142,13 +142,13 @@ namespace AZ
         }
         }
 
 
         template <class T>
         template <class T>
-        AZStd::enable_if_t<std::is_pod<T>::value> InitializeDefaultIfPodType(T& t)
+        AZStd::enable_if_t<std::is_trivial<T>::value> InitializeDefaultIfPodType(T& t)
         {
         {
             t = T{};
             t = T{};
         }
         }
 
 
         template <class T>
         template <class T>
-        AZStd::enable_if_t<!std::is_pod<T>::value> InitializeDefaultIfPodType(T& t)
+        AZStd::enable_if_t<!std::is_trivial<T>::value> InitializeDefaultIfPodType(T& t)
         {
         {
             (void)t;
             (void)t;
         }
         }

+ 0 - 1
Code/Framework/AzCore/AzCore/std/azstd_files.cmake

@@ -227,7 +227,6 @@ set(FILES
     typetraits/is_member_object_pointer.h
     typetraits/is_member_object_pointer.h
     typetraits/is_member_pointer.h
     typetraits/is_member_pointer.h
     typetraits/is_object.h
     typetraits/is_object.h
-    typetraits/is_pod.h
     typetraits/is_pointer.h
     typetraits/is_pointer.h
     typetraits/is_polymorphic.h
     typetraits/is_polymorphic.h
     typetraits/is_reference.h
     typetraits/is_reference.h

+ 0 - 16
Code/Framework/AzCore/AzCore/std/typetraits/is_pod.h

@@ -1,16 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <AzCore/std/typetraits/config.h>
-
-namespace AZStd
-{
-    using std::is_pod;
-    using std::is_pod_v;
-}

+ 0 - 1
Code/Framework/AzCore/AzCore/std/typetraits/typetraits.h

@@ -59,7 +59,6 @@
 #include <AzCore/std/typetraits/is_member_object_pointer.h>
 #include <AzCore/std/typetraits/is_member_object_pointer.h>
 #include <AzCore/std/typetraits/is_member_pointer.h>
 #include <AzCore/std/typetraits/is_member_pointer.h>
 #include <AzCore/std/typetraits/is_object.h>
 #include <AzCore/std/typetraits/is_object.h>
-#include <AzCore/std/typetraits/is_pod.h>
 #include <AzCore/std/typetraits/is_polymorphic.h>
 #include <AzCore/std/typetraits/is_polymorphic.h>
 #include <AzCore/std/typetraits/is_pointer.h>
 #include <AzCore/std/typetraits/is_pointer.h>
 #include <AzCore/std/typetraits/is_reference.h>
 #include <AzCore/std/typetraits/is_reference.h>

+ 3 - 4
Code/Framework/AzCore/Tests/AZStd/Examples.cpp

@@ -57,10 +57,9 @@ namespace UnitTest
             // Make sure the buffer pointer is aligned to 16 bytes.
             // Make sure the buffer pointer is aligned to 16 bytes.
             AZ_TEST_ASSERT((AZStd::size_t(&myAlignedBuffer) & 15) == 0);
             AZ_TEST_ASSERT((AZStd::size_t(&myAlignedBuffer) & 15) == 0);
 
 
-            // POD
-            // Checks if a type is POD (Plain Old Data).
-            AZ_TEST_STATIC_ASSERT(is_pod<MyStruct>::value == true);
-            AZ_TEST_STATIC_ASSERT(is_pod<MyClass>::value == false);
+            // Checks if a type is trivial
+            AZ_TEST_STATIC_ASSERT(is_trivial<MyStruct>::value == true);
+            AZ_TEST_STATIC_ASSERT(is_trivial<MyClass>::value == false);
 
 
             // TypeTraitExample-End
             // TypeTraitExample-End
         }
         }

+ 1 - 8
Code/Framework/AzCore/Tests/AZStd/TypeTraits.cpp

@@ -35,8 +35,7 @@ namespace UnitTest
      * template <class T> struct has_nothrow_constructor;
      * template <class T> struct has_nothrow_constructor;
      * template <class T> struct has_nothrow_copy;
      * template <class T> struct has_nothrow_copy;
      * template <class T> struct has_nothrow_assign;
      * template <class T> struct has_nothrow_assign;
-     * template <class T> struct is_pod;
-     * template <class T> struct is_abstract;
+          * template <class T> struct is_abstract;
      * \endcond
      * \endcond
      */
      */
     TEST(TypeTraits, All)
     TEST(TypeTraits, All)
@@ -218,12 +217,6 @@ namespace UnitTest
         static_assert(is_volatile<volatile MyStruct>::value == true);
         static_assert(is_volatile<volatile MyStruct>::value == true);
         static_assert(is_volatile<volatile float>::value == true);
         static_assert(is_volatile<volatile float>::value == true);
 
 
-        // is_pod
-        static_assert(is_pod<MyStruct>::value == true);
-        static_assert(is_pod<int>::value == true);
-        static_assert(is_pod<const MyClass>::value == false);
-        static_assert((is_pod< aligned_storage<30, 32>::type >::value) == true);
-
         // is_empty
         // is_empty
         static_assert(is_empty<MyStruct>::value == false);
         static_assert(is_empty<MyStruct>::value == false);
         static_assert(is_empty<MyEmptyStruct>::value == true);
         static_assert(is_empty<MyEmptyStruct>::value == true);