[libc++] Move guards against std::auto_ptr outside of auto_ptr.h
This makes it clear that headers like <memory> which include auto_ptr
only do that when compiling under an older Standard, or when the removed
feature is explicitly requested.
GitOrigin-RevId: 207d58bf31ab975203c6bb818ee4167a09c195ce
diff --git a/include/memory b/include/memory
index ae3c2ce..35c0a29 100644
--- a/include/memory
+++ b/include/memory
@@ -682,7 +682,6 @@
#include <__memory/allocation_guard.h>
#include <__memory/allocator.h>
#include <__memory/allocator_traits.h>
-#include <__memory/auto_ptr.h>
#include <__memory/compressed_pair.h>
#include <__memory/construct_at.h>
#include <__memory/pointer_safety.h>
@@ -694,6 +693,10 @@
#include <__memory/unique_ptr.h>
#include <version>
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
+# include <__memory/auto_ptr.h>
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif