Quellcode durchsuchen

stl: prepare to move all <memory> stuff

skypjack vor 1 Tag
Ursprung
Commit
d200d8b3dc
1 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen
  1. 11 6
      src/entt/stl/memory.hpp

+ 11 - 6
src/entt/stl/memory.hpp

@@ -1,15 +1,21 @@
 #ifndef ENTT_STL_MEMORY_HPP
 #define ENTT_STL_MEMORY_HPP
 
+#include <memory>
 #include "../config/config.h"
 #include "version.hpp"
 
 /*! @cond ENTT_INTERNAL */
+namespace entt::stl {
+
+using std::pointer_traits;
+
+}
+
 #ifndef ENTT_FORCE_STL
 #    ifdef ENTT_HAS_VERSION
 #        if defined(__cpp_lib_to_address)
 #            define ENTT_HAS_TO_ADDRESS
-#            include <memory>
 
 namespace entt::stl {
 
@@ -22,21 +28,20 @@ using std::to_address;
 #endif
 
 #ifndef ENTT_HAS_TO_ADDRESS
-#    include <memory>
-#    include <type_traits>
+#    include "type_traits.hpp"
 
 namespace entt::stl {
 
 template<typename Type>
 constexpr Type *to_address(Type *ptr) noexcept {
-    static_assert(!std::is_function_v<Type>, "Invalid type");
+    static_assert(!is_function_v<Type>, "Invalid type");
     return ptr;
 }
 
 template<typename Type>
 constexpr auto to_address(const Type &ptr) noexcept {
-    if constexpr(requires { std::pointer_traits<Type>::to_address(ptr); }) {
-        return std::pointer_traits<Type>::to_address(ptr);
+    if constexpr(requires { pointer_traits<Type>::to_address(ptr); }) {
+        return pointer_traits<Type>::to_address(ptr);
     } else {
         return to_address(ptr.operator->());
     }