Procházet zdrojové kódy

mark some types in std as trivially_relocatable

ykiko před 2 roky
rodič
revize
458dd32af8
1 změnil soubory, kde provedl 20 přidání a 0 odebrání
  1. 20 0
      include/pocketpy/vector.h

+ 20 - 0
include/pocketpy/vector.h

@@ -190,6 +190,26 @@ namespace pkpy {
     constexpr inline bool is_trivially_relocatable_v =
             TriviallyRelocatable<T>::value;
 
+    template<typename T>
+    struct TriviallyRelocatable<std::unique_ptr<T>>{
+        constexpr static bool value = true;
+    };
+
+    template<typename T>
+    struct TriviallyRelocatable<std::shared_ptr<T>>{
+        constexpr static bool value = true;
+    };
+
+    template<typename T>
+    struct TriviallyRelocatable<std::weak_ptr<T>>{
+        constexpr static bool value = true;
+    };
+
+    template<typename T>
+    struct TriviallyRelocatable<std::vector<T>>{
+        constexpr static bool value = true;
+    };
+
 // the implementation of small_vector
     template <typename T, std::size_t N> class small_vector {
     public: