[libcxx-commits] [libcxx] 7ad49ae - [libc++] Split allocator_traits and pointer_traits out of <memory>
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 14 13:14:24 PST 2020
Author: Louis Dionne
Date: 2020-12-14T16:13:57-05:00
New Revision: 7ad49aec125b3c1205b164331d0aa954d773f890
URL: https://github.com/llvm/llvm-project/commit/7ad49aec125b3c1205b164331d0aa954d773f890
DIFF: https://github.com/llvm/llvm-project/commit/7ad49aec125b3c1205b164331d0aa954d773f890.diff
LOG: [libc++] Split allocator_traits and pointer_traits out of <memory>
In addition to making the code a lot easier to grasp by localizing many
helper functions to the only file where they are actually needed, this
will allow creating helper functions that depend on allocator_traits
outside of <memory>.
This is done as part of implementing array support in allocate_shared,
which requires non-trivial array initialization algorithms that would be
better to keep out of <memory> for sanity. It's also a first step towards
splitting up our monolithic headers into finer grained ones, which will
make it easier to reuse functionality across the library. For example,
it's just weird that we had to define `addressof` inside <type_traits>
to avoid circular dependencies -- instead it's better to implement those
in true helper headers.
Differential Revision: https://reviews.llvm.org/D93074
Added:
libcxx/include/__memory/allocator_traits.h
libcxx/include/__memory/base.h
libcxx/include/__memory/pointer_traits.h
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/exception
libcxx/include/iterator
libcxx/include/memory
libcxx/include/type_traits
libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
Removed:
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index e0f05da65996..71361a9e53df 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -11,6 +11,9 @@ set(files
__hash_table
__libcpp_version
__locale
+ __memory/allocator_traits.h
+ __memory/base.h
+ __memory/pointer_traits.h
__mutex_base
__node_handle
__nullptr
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
new file mode 100644
index 000000000000..cdbdb9ef8e37
--- /dev/null
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -0,0 +1,589 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
+#define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
+
+#include <__config>
+#include <__memory/base.h>
+#include <__memory/pointer_traits.h>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class = void>
+struct __has_pointer_type : false_type {};
+
+template <class _Tp>
+struct __has_pointer_type<_Tp,
+ typename __void_t<typename _Tp::pointer>::type> : true_type {};
+
+namespace __pointer_type_imp
+{
+
+template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
+struct __pointer_type
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type;
+};
+
+template <class _Tp, class _Dp>
+struct __pointer_type<_Tp, _Dp, false>
+{
+ typedef _LIBCPP_NODEBUG_TYPE _Tp* type;
+};
+
+} // __pointer_type_imp
+
+template <class _Tp, class _Dp>
+struct __pointer_type
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
+};
+
+template <class _Tp, class = void>
+struct __has_const_pointer : false_type {};
+
+template <class _Tp>
+struct __has_const_pointer<_Tp,
+ typename __void_t<typename _Tp::const_pointer>::type> : true_type {};
+
+template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
+struct __const_pointer
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type;
+};
+
+template <class _Tp, class _Ptr, class _Alloc>
+struct __const_pointer<_Tp, _Ptr, _Alloc, false>
+{
+#ifndef _LIBCPP_CXX03_LANG
+ typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
+#else
+ typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;
+#endif
+};
+
+template <class _Tp, class = void>
+struct __has_void_pointer : false_type {};
+
+template <class _Tp>
+struct __has_void_pointer<_Tp,
+ typename __void_t<typename _Tp::void_pointer>::type> : true_type {};
+
+template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
+struct __void_pointer
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type;
+};
+
+template <class _Ptr, class _Alloc>
+struct __void_pointer<_Ptr, _Alloc, false>
+{
+#ifndef _LIBCPP_CXX03_LANG
+ typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void> type;
+#else
+ typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void>::other type;
+#endif
+};
+
+template <class _Tp, class = void>
+struct __has_const_void_pointer : false_type {};
+
+template <class _Tp>
+struct __has_const_void_pointer<_Tp,
+ typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {};
+
+template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
+struct __const_void_pointer
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type;
+};
+
+template <class _Ptr, class _Alloc>
+struct __const_void_pointer<_Ptr, _Alloc, false>
+{
+#ifndef _LIBCPP_CXX03_LANG
+ typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void> type;
+#else
+ typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void>::other type;
+#endif
+};
+
+template <class _Tp, class = void>
+struct __has_size_type : false_type {};
+
+template <class _Tp>
+struct __has_size_type<_Tp,
+ typename __void_t<typename _Tp::size_type>::type> : true_type {};
+
+template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
+struct __size_type
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type;
+};
+
+template <class _Alloc, class _DiffType>
+struct __size_type<_Alloc, _DiffType, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type;
+};
+
+template <class _Tp, class = void>
+struct __has_propagate_on_container_copy_assignment : false_type {};
+
+template <class _Tp>
+struct __has_propagate_on_container_copy_assignment<_Tp,
+ typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type>
+ : true_type {};
+
+template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
+struct __propagate_on_container_copy_assignment
+{
+ typedef _LIBCPP_NODEBUG_TYPE false_type type;
+};
+
+template <class _Alloc>
+struct __propagate_on_container_copy_assignment<_Alloc, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type;
+};
+
+template <class _Tp, class = void>
+struct __has_propagate_on_container_move_assignment : false_type {};
+
+template <class _Tp>
+struct __has_propagate_on_container_move_assignment<_Tp,
+ typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type>
+ : true_type {};
+
+template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
+struct __propagate_on_container_move_assignment
+{
+ typedef false_type type;
+};
+
+template <class _Alloc>
+struct __propagate_on_container_move_assignment<_Alloc, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type;
+};
+
+template <class _Tp, class = void>
+struct __has_propagate_on_container_swap : false_type {};
+
+template <class _Tp>
+struct __has_propagate_on_container_swap<_Tp,
+ typename __void_t<typename _Tp::propagate_on_container_swap>::type>
+ : true_type {};
+
+template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
+struct __propagate_on_container_swap
+{
+ typedef false_type type;
+};
+
+template <class _Alloc>
+struct __propagate_on_container_swap<_Alloc, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type;
+};
+
+template <class _Tp, class = void>
+struct __has_is_always_equal : false_type {};
+
+template <class _Tp>
+struct __has_is_always_equal<_Tp,
+ typename __void_t<typename _Tp::is_always_equal>::type>
+ : true_type {};
+
+template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
+struct __is_always_equal
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type;
+};
+
+template <class _Alloc>
+struct __is_always_equal<_Alloc, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type;
+};
+
+template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
+struct __has_rebind_other
+{
+private:
+ struct __two {char __lx; char __lxx;};
+ template <class _Xp> static __two __test(...);
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+public:
+ static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Tp, class _Up>
+struct __has_rebind_other<_Tp, _Up, false>
+{
+ static const bool value = false;
+};
+
+template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
+struct __allocator_traits_rebind
+{
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+};
+
+template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
+{
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+};
+
+template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
+{
+ typedef _LIBCPP_NODEBUG_TYPE _Alloc<_Up, _Args...> type;
+};
+
+#ifndef _LIBCPP_CXX03_LANG
+
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
+template <class _Alloc, class _SizeType, class _ConstVoidPtr>
+auto
+__has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
+ -> decltype((void)__a.allocate(__sz, __p), true_type());
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+
+template <class _Alloc, class _SizeType, class _ConstVoidPtr>
+auto
+__has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
+ -> false_type;
+
+template <class _Alloc, class _SizeType, class _ConstVoidPtr>
+struct __has_allocate_hint
+ : decltype(_VSTD::__has_allocate_hint_test(declval<_Alloc>(),
+ declval<_SizeType>(),
+ declval<_ConstVoidPtr>()))
+{
+};
+
+#else // _LIBCPP_CXX03_LANG
+
+template <class _Alloc, class _SizeType, class _ConstVoidPtr>
+struct __has_allocate_hint
+ : true_type
+{
+};
+
+#endif // _LIBCPP_CXX03_LANG
+
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
+template <class _Alloc, class ..._Args,
+ class = decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Args>()...))>
+static true_type __test_has_construct(int);
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+
+template <class _Alloc, class...>
+static false_type __test_has_construct(...);
+
+template <class _Alloc, class ..._Args>
+struct __has_construct : decltype(__test_has_construct<_Alloc, _Args...>(0)) {};
+
+#if !defined(_LIBCPP_CXX03_LANG)
+
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
+template <class _Alloc, class _Pointer>
+auto
+__has_destroy_test(_Alloc&& __a, _Pointer&& __p)
+ -> decltype(__a.destroy(__p), true_type());
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+
+template <class _Alloc, class _Pointer>
+auto
+__has_destroy_test(const _Alloc& __a, _Pointer&& __p)
+ -> false_type;
+
+template <class _Alloc, class _Pointer>
+struct __has_destroy
+ : decltype(_VSTD::__has_destroy_test(declval<_Alloc>(),
+ declval<_Pointer>()))
+{
+};
+
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
+template <class _Alloc>
+auto
+__has_max_size_test(_Alloc&& __a)
+ -> decltype(__a.max_size(), true_type());
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+
+template <class _Alloc>
+auto
+__has_max_size_test(const volatile _Alloc& __a)
+ -> false_type;
+
+template <class _Alloc>
+struct __has_max_size
+ : decltype(_VSTD::__has_max_size_test(declval<_Alloc&>()))
+{
+};
+
+template <class _Alloc>
+auto
+__has_select_on_container_copy_construction_test(_Alloc&& __a)
+ -> decltype(__a.select_on_container_copy_construction(), true_type());
+
+template <class _Alloc>
+auto
+__has_select_on_container_copy_construction_test(const volatile _Alloc& __a)
+ -> false_type;
+
+template <class _Alloc>
+struct __has_select_on_container_copy_construction
+ : decltype(_VSTD::__has_select_on_container_copy_construction_test(declval<_Alloc&>()))
+{
+};
+
+#else // _LIBCPP_CXX03_LANG
+
+template <class _Alloc, class _Pointer, class = void>
+struct __has_destroy : false_type {};
+
+template <class _Alloc, class _Pointer>
+struct __has_destroy<_Alloc, _Pointer, typename __void_t<
+ decltype(_VSTD::declval<_Alloc>().destroy(_VSTD::declval<_Pointer>()))
+>::type> : true_type {};
+
+template <class _Alloc>
+struct __has_max_size
+ : true_type
+{
+};
+
+template <class _Alloc>
+struct __has_select_on_container_copy_construction
+ : false_type
+{
+};
+
+#endif // _LIBCPP_CXX03_LANG
+
+template <class _Alloc, class _Ptr, bool = __has_
diff erence_type<_Alloc>::value>
+struct __alloc_traits_
diff erence_type
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::
diff erence_type type;
+};
+
+template <class _Alloc, class _Ptr>
+struct __alloc_traits_
diff erence_type<_Alloc, _Ptr, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::
diff erence_type type;
+};
+
+template <class _Tp>
+struct __is_default_allocator : false_type {};
+
+template <class _Tp>
+struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {};
+
+
+
+template <class _Alloc,
+ bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value
+ >
+struct __is_cpp17_move_insertable;
+template <class _Alloc>
+struct __is_cpp17_move_insertable<_Alloc, true> : true_type {};
+template <class _Alloc>
+struct __is_cpp17_move_insertable<_Alloc, false> : is_move_constructible<typename _Alloc::value_type> {};
+
+template <class _Alloc,
+ bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value
+ >
+struct __is_cpp17_copy_insertable;
+template <class _Alloc>
+struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {};
+template <class _Alloc>
+struct __is_cpp17_copy_insertable<_Alloc, false> : integral_constant<bool,
+ is_copy_constructible<typename _Alloc::value_type>::value &&
+ __is_cpp17_move_insertable<_Alloc>::value>
+ {};
+
+
+
+template <class _Alloc>
+struct _LIBCPP_TEMPLATE_VIS allocator_traits
+{
+ typedef _Alloc allocator_type;
+ typedef typename allocator_type::value_type value_type;
+
+ typedef typename __pointer_type<value_type, allocator_type>::type pointer;
+ typedef typename __const_pointer<value_type, pointer, allocator_type>::type const_pointer;
+ typedef typename __void_pointer<pointer, allocator_type>::type void_pointer;
+ typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer;
+
+ typedef typename __alloc_traits_
diff erence_type<allocator_type, pointer>::type
diff erence_type;
+ typedef typename __size_type<allocator_type,
diff erence_type>::type size_type;
+
+ typedef typename __propagate_on_container_copy_assignment<allocator_type>::type
+ propagate_on_container_copy_assignment;
+ typedef typename __propagate_on_container_move_assignment<allocator_type>::type
+ propagate_on_container_move_assignment;
+ typedef typename __propagate_on_container_swap<allocator_type>::type
+ propagate_on_container_swap;
+ typedef typename __is_always_equal<allocator_type>::type
+ is_always_equal;
+
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _Tp> using rebind_alloc =
+ typename __allocator_traits_rebind<allocator_type, _Tp>::type;
+ template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
+#else // _LIBCPP_CXX03_LANG
+ template <class _Tp> struct rebind_alloc
+ {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;};
+ template <class _Tp> struct rebind_traits
+ {typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;};
+#endif // _LIBCPP_CXX03_LANG
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static pointer allocate(allocator_type& __a, size_type __n)
+ {return __a.allocate(__n);}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
+ {return __allocate(__a, __n, __hint,
+ __has_allocate_hint<allocator_type, size_type, const_void_pointer>());}
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT
+ {__a.deallocate(__p, __n);}
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
+ {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
+ __a, __p, _VSTD::forward<_Args>(__args)...);}
+
+ template <class _Tp>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static void destroy(allocator_type& __a, _Tp* __p)
+ {__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static size_type max_size(const allocator_type& __a) _NOEXCEPT
+ {return __max_size(__has_max_size<const allocator_type>(), __a);}
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static allocator_type
+ select_on_container_copy_construction(const allocator_type& __a)
+ {return __select_on_container_copy_construction(
+ __has_select_on_container_copy_construction<const allocator_type>(),
+ __a);}
+
+private:
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static pointer __allocate(allocator_type& __a, size_type __n,
+ const_void_pointer __hint, true_type)
+ {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ return __a.allocate(__n, __hint);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static pointer __allocate(allocator_type& __a, size_type __n,
+ const_void_pointer, false_type)
+ {return __a.allocate(__n);}
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args)
+ {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __a.construct(__p, _VSTD::forward<_Args>(__args)...);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args)
+ {
+#if _LIBCPP_STD_VER > 17
+ _VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...);
+#else
+ ::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...);
+#endif
+ }
+
+ template <class _Tp>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static void __destroy(true_type, allocator_type& __a, _Tp* __p)
+ {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __a.destroy(__p);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Tp>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static void __destroy(false_type, allocator_type&, _Tp* __p)
+ {
+#if _LIBCPP_STD_VER > 17
+ _VSTD::destroy_at(__p);
+#else
+ __p->~_Tp();
+#endif
+ }
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static size_type __max_size(true_type, const allocator_type& __a) _NOEXCEPT
+ {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ return __a.max_size();
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static size_type __max_size(false_type, const allocator_type&) _NOEXCEPT
+ {return numeric_limits<size_type>::max() / sizeof(value_type);}
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static allocator_type
+ __select_on_container_copy_construction(true_type, const allocator_type& __a)
+ {return __a.select_on_container_copy_construction();}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static allocator_type
+ __select_on_container_copy_construction(false_type, const allocator_type& __a)
+ {return __a;}
+};
+
+template <class _Traits, class _Tp>
+struct __rebind_alloc_helper
+{
+#ifndef _LIBCPP_CXX03_LANG
+ typedef _LIBCPP_NODEBUG_TYPE typename _Traits::template rebind_alloc<_Tp> type;
+#else
+ typedef typename _Traits::template rebind_alloc<_Tp>::other type;
+#endif
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
diff --git a/libcxx/include/__memory/base.h b/libcxx/include/__memory/base.h
new file mode 100644
index 000000000000..70728bd7f8ef
--- /dev/null
+++ b/libcxx/include/__memory/base.h
@@ -0,0 +1,127 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___MEMORY_BASE_H
+#define _LIBCPP___MEMORY_BASE_H
+
+#include <__config>
+#include <__debug>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// addressof
+#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
+
+template <class _Tp>
+inline _LIBCPP_CONSTEXPR_AFTER_CXX14
+_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
+_Tp*
+addressof(_Tp& __x) _NOEXCEPT
+{
+ return __builtin_addressof(__x);
+}
+
+#else
+
+template <class _Tp>
+inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
+_Tp*
+addressof(_Tp& __x) _NOEXCEPT
+{
+ return reinterpret_cast<_Tp *>(
+ const_cast<char *>(&reinterpret_cast<const volatile char &>(__x)));
+}
+
+#endif // _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
+
+#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
+// Objective-C++ Automatic Reference Counting uses qualified pointers
+// that require special addressof() signatures. When
+// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
+// itself is providing these definitions. Otherwise, we provide them.
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__strong _Tp*
+addressof(__strong _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+
+#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__weak _Tp*
+addressof(__weak _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+#endif
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__autoreleasing _Tp*
+addressof(__autoreleasing _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__unsafe_unretained _Tp*
+addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+#endif
+
+#if !defined(_LIBCPP_CXX03_LANG)
+template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
+#endif
+
+// construct_at
+
+#if _LIBCPP_STD_VER > 17
+
+template<class _Tp, class ..._Args, class = decltype(
+ ::new (_VSTD::declval<void*>()) _Tp(_VSTD::declval<_Args>()...)
+)>
+_LIBCPP_INLINE_VISIBILITY
+constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) {
+ _LIBCPP_ASSERT(__location, "null pointer given to construct_at");
+ return ::new ((void*)__location) _Tp(_VSTD::forward<_Args>(__args)...);
+}
+
+#endif
+
+// destroy_at
+
+#if _LIBCPP_STD_VER > 14
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+void destroy_at(_Tp* __loc) {
+ _LIBCPP_ASSERT(__loc, "null pointer given to destroy_at");
+ __loc->~_Tp();
+}
+
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___MEMORY_BASE_H
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
new file mode 100644
index 000000000000..b2c5d34cb082
--- /dev/null
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -0,0 +1,169 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___MEMORY_POINTER_TRAITS_H
+#define _LIBCPP___MEMORY_POINTER_TRAITS_H
+
+#include <__config>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class = void>
+struct __has_element_type : false_type {};
+
+template <class _Tp>
+struct __has_element_type<_Tp,
+ typename __void_t<typename _Tp::element_type>::type> : true_type {};
+
+template <class _Ptr, bool = __has_element_type<_Ptr>::value>
+struct __pointer_traits_element_type;
+
+template <class _Ptr>
+struct __pointer_traits_element_type<_Ptr, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type;
+};
+
+template <template <class, class...> class _Sp, class _Tp, class ..._Args>
+struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
+};
+
+template <template <class, class...> class _Sp, class _Tp, class ..._Args>
+struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
+{
+ typedef _LIBCPP_NODEBUG_TYPE _Tp type;
+};
+
+template <class _Tp, class = void>
+struct __has_
diff erence_type : false_type {};
+
+template <class _Tp>
+struct __has_
diff erence_type<_Tp,
+ typename __void_t<typename _Tp::
diff erence_type>::type> : true_type {};
+
+template <class _Ptr, bool = __has_
diff erence_type<_Ptr>::value>
+struct __pointer_traits_
diff erence_type
+{
+ typedef _LIBCPP_NODEBUG_TYPE ptr
diff _t type;
+};
+
+template <class _Ptr>
+struct __pointer_traits_
diff erence_type<_Ptr, true>
+{
+ typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::
diff erence_type type;
+};
+
+template <class _Tp, class _Up>
+struct __has_rebind
+{
+private:
+ struct __two {char __lx; char __lxx;};
+ template <class _Xp> static __two __test(...);
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+public:
+ static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
+struct __pointer_traits_rebind
+{
+#ifndef _LIBCPP_CXX03_LANG
+ typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type;
+#else
+ typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
+#endif
+};
+
+template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
+{
+#ifndef _LIBCPP_CXX03_LANG
+ typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
+#else
+ typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
+#endif
+};
+
+template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
+{
+ typedef _Sp<_Up, _Args...> type;
+};
+
+template <class _Ptr>
+struct _LIBCPP_TEMPLATE_VIS pointer_traits
+{
+ typedef _Ptr pointer;
+ typedef typename __pointer_traits_element_type<pointer>::type element_type;
+ typedef typename __pointer_traits_
diff erence_type<pointer>::type
diff erence_type;
+
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
+#else
+ template <class _Up> struct rebind
+ {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
+#endif // _LIBCPP_CXX03_LANG
+
+private:
+ struct __nat {};
+public:
+ _LIBCPP_INLINE_VISIBILITY
+ static pointer pointer_to(typename conditional<is_void<element_type>::value,
+ __nat, element_type>::type& __r)
+ {return pointer::pointer_to(__r);}
+};
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*>
+{
+ typedef _Tp* pointer;
+ typedef _Tp element_type;
+ typedef ptr
diff _t
diff erence_type;
+
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _Up> using rebind = _Up*;
+#else
+ template <class _Up> struct rebind {typedef _Up* other;};
+#endif
+
+private:
+ struct __nat {};
+public:
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ static pointer pointer_to(typename conditional<is_void<element_type>::value,
+ __nat, element_type>::type& __r) _NOEXCEPT
+ {return _VSTD::addressof(__r);}
+};
+
+template <class _From, class _To>
+struct __rebind_pointer {
+#ifndef _LIBCPP_CXX03_LANG
+ typedef typename pointer_traits<_From>::template rebind<_To> type;
+#else
+ typedef typename pointer_traits<_From>::template rebind<_To>::other type;
+#endif
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___MEMORY_POINTER_TRAITS_H
diff --git a/libcxx/include/exception b/libcxx/include/exception
index a668539be899..4bf4049f3325 100644
--- a/libcxx/include/exception
+++ b/libcxx/include/exception
@@ -78,6 +78,7 @@ template <class E> void rethrow_if_nested(const E& e);
#include <__config>
#include <__availability>
+#include <__memory/base.h>
#include <cstddef>
#include <cstdlib>
#include <type_traits>
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index 3e1fb610821a..00a3451e7a21 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -420,6 +420,7 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
#include <type_traits>
#include <cstddef>
#include <initializer_list>
+#include <__memory/base.h>
#include <version>
#include <__debug>
diff --git a/libcxx/include/memory b/libcxx/include/memory
index 883a01d7d2f0..f81ff6680f9f 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -679,6 +679,9 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <tuple>
#include <stdexcept>
#include <cstring>
+#include <__memory/allocator_traits.h>
+#include <__memory/base.h>
+#include <__memory/pointer_traits.h>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
@@ -718,306 +721,6 @@ _ValueType __libcpp_acquire_load(_ValueType const* __value) {
#endif
}
-// addressof moved to <type_traits>
-
-template <class _Tp> class allocator;
-
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
-template <>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void>
-{
-public:
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-
- template <class _Up> struct rebind {typedef allocator<_Up> other;};
-};
-
-template <>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<const void>
-{
-public:
- typedef const void* pointer;
- typedef const void* const_pointer;
- typedef const void value_type;
-
- template <class _Up> struct rebind {typedef allocator<_Up> other;};
-};
-#endif
-
-// pointer_traits
-
-template <class _Tp, class = void>
-struct __has_element_type : false_type {};
-
-template <class _Tp>
-struct __has_element_type<_Tp,
- typename __void_t<typename _Tp::element_type>::type> : true_type {};
-
-template <class _Ptr, bool = __has_element_type<_Ptr>::value>
-struct __pointer_traits_element_type;
-
-template <class _Ptr>
-struct __pointer_traits_element_type<_Ptr, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type;
-};
-
-template <template <class, class...> class _Sp, class _Tp, class ..._Args>
-struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
-};
-
-template <template <class, class...> class _Sp, class _Tp, class ..._Args>
-struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
-{
- typedef _LIBCPP_NODEBUG_TYPE _Tp type;
-};
-
-template <class _Tp, class = void>
-struct __has_
diff erence_type : false_type {};
-
-template <class _Tp>
-struct __has_
diff erence_type<_Tp,
- typename __void_t<typename _Tp::
diff erence_type>::type> : true_type {};
-
-template <class _Ptr, bool = __has_
diff erence_type<_Ptr>::value>
-struct __pointer_traits_
diff erence_type
-{
- typedef _LIBCPP_NODEBUG_TYPE ptr
diff _t type;
-};
-
-template <class _Ptr>
-struct __pointer_traits_
diff erence_type<_Ptr, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::
diff erence_type type;
-};
-
-template <class _Tp, class _Up>
-struct __has_rebind
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Xp> static __two __test(...);
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
-
-template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
-struct __pointer_traits_rebind
-{
-#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type;
-#else
- typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
-#endif
-};
-
-template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
-struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
-{
-#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
-#else
- typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
-#endif
-};
-
-template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
-struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
-{
- typedef _Sp<_Up, _Args...> type;
-};
-
-template <class _Ptr>
-struct _LIBCPP_TEMPLATE_VIS pointer_traits
-{
- typedef _Ptr pointer;
- typedef typename __pointer_traits_element_type<pointer>::type element_type;
- typedef typename __pointer_traits_
diff erence_type<pointer>::type
diff erence_type;
-
-#ifndef _LIBCPP_CXX03_LANG
- template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
-#else
- template <class _Up> struct rebind
- {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
-#endif // _LIBCPP_CXX03_LANG
-
-private:
- struct __nat {};
-public:
- _LIBCPP_INLINE_VISIBILITY
- static pointer pointer_to(typename conditional<is_void<element_type>::value,
- __nat, element_type>::type& __r)
- {return pointer::pointer_to(__r);}
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*>
-{
- typedef _Tp* pointer;
- typedef _Tp element_type;
- typedef ptr
diff _t
diff erence_type;
-
-#ifndef _LIBCPP_CXX03_LANG
- template <class _Up> using rebind = _Up*;
-#else
- template <class _Up> struct rebind {typedef _Up* other;};
-#endif
-
-private:
- struct __nat {};
-public:
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static pointer pointer_to(typename conditional<is_void<element_type>::value,
- __nat, element_type>::type& __r) _NOEXCEPT
- {return _VSTD::addressof(__r);}
-};
-
-template <class _From, class _To>
-struct __rebind_pointer {
-#ifndef _LIBCPP_CXX03_LANG
- typedef typename pointer_traits<_From>::template rebind<_To> type;
-#else
- typedef typename pointer_traits<_From>::template rebind<_To>::other type;
-#endif
-};
-
-// construct_at
-
-#if _LIBCPP_STD_VER > 17
-
-template<class _Tp, class ..._Args, class = decltype(
- ::new (declval<void*>()) _Tp(declval<_Args>()...)
-)>
-_LIBCPP_INLINE_VISIBILITY
-constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) {
- _LIBCPP_ASSERT(__location, "null pointer given to construct_at");
- return ::new ((void*)__location) _Tp(_VSTD::forward<_Args>(__args)...);
-}
-
-#endif
-
-// destroy_at
-
-#if _LIBCPP_STD_VER > 14
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-void destroy_at(_Tp* __loc) {
- _LIBCPP_ASSERT(__loc, "null pointer given to destroy_at");
- __loc->~_Tp();
-}
-
-#endif
-
-// allocator_traits
-
-template <class _Tp, class = void>
-struct __has_pointer_type : false_type {};
-
-template <class _Tp>
-struct __has_pointer_type<_Tp,
- typename __void_t<typename _Tp::pointer>::type> : true_type {};
-
-namespace __pointer_type_imp
-{
-
-template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
-struct __pointer_type
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type;
-};
-
-template <class _Tp, class _Dp>
-struct __pointer_type<_Tp, _Dp, false>
-{
- typedef _LIBCPP_NODEBUG_TYPE _Tp* type;
-};
-
-} // __pointer_type_imp
-
-template <class _Tp, class _Dp>
-struct __pointer_type
-{
- typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
-};
-
-template <class _Tp, class = void>
-struct __has_const_pointer : false_type {};
-
-template <class _Tp>
-struct __has_const_pointer<_Tp,
- typename __void_t<typename _Tp::const_pointer>::type> : true_type {};
-
-template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
-struct __const_pointer
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type;
-};
-
-template <class _Tp, class _Ptr, class _Alloc>
-struct __const_pointer<_Tp, _Ptr, _Alloc, false>
-{
-#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
-#else
- typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;
-#endif
-};
-
-template <class _Tp, class = void>
-struct __has_void_pointer : false_type {};
-
-template <class _Tp>
-struct __has_void_pointer<_Tp,
- typename __void_t<typename _Tp::void_pointer>::type> : true_type {};
-
-template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
-struct __void_pointer
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type;
-};
-
-template <class _Ptr, class _Alloc>
-struct __void_pointer<_Ptr, _Alloc, false>
-{
-#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void> type;
-#else
- typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void>::other type;
-#endif
-};
-
-template <class _Tp, class = void>
-struct __has_const_void_pointer : false_type {};
-
-template <class _Tp>
-struct __has_const_void_pointer<_Tp,
- typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {};
-
-template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
-struct __const_void_pointer
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type;
-};
-
-template <class _Ptr, class _Alloc>
-struct __const_void_pointer<_Ptr, _Alloc, false>
-{
-#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void> type;
-#else
- typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void>::other type;
-#endif
-};
-
-
template <bool _UsePointerTraits> struct __to_address_helper;
template <> struct __to_address_helper<true> {
@@ -1080,464 +783,31 @@ to_address(const _Pointer& __p) _NOEXCEPT
}
#endif
-template <class _Tp, class = void>
-struct __has_size_type : false_type {};
-
-template <class _Tp>
-struct __has_size_type<_Tp,
- typename __void_t<typename _Tp::size_type>::type> : true_type {};
-
-template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
-struct __size_type
-{
- typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type;
-};
-
-template <class _Alloc, class _DiffType>
-struct __size_type<_Alloc, _DiffType, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type;
-};
-
-template <class _Tp, class = void>
-struct __has_propagate_on_container_copy_assignment : false_type {};
-
-template <class _Tp>
-struct __has_propagate_on_container_copy_assignment<_Tp,
- typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type>
- : true_type {};
-
-template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
-struct __propagate_on_container_copy_assignment
-{
- typedef _LIBCPP_NODEBUG_TYPE false_type type;
-};
-
-template <class _Alloc>
-struct __propagate_on_container_copy_assignment<_Alloc, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type;
-};
-
-template <class _Tp, class = void>
-struct __has_propagate_on_container_move_assignment : false_type {};
-
-template <class _Tp>
-struct __has_propagate_on_container_move_assignment<_Tp,
- typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type>
- : true_type {};
-
-template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
-struct __propagate_on_container_move_assignment
-{
- typedef false_type type;
-};
-
-template <class _Alloc>
-struct __propagate_on_container_move_assignment<_Alloc, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type;
-};
-
-template <class _Tp, class = void>
-struct __has_propagate_on_container_swap : false_type {};
-
-template <class _Tp>
-struct __has_propagate_on_container_swap<_Tp,
- typename __void_t<typename _Tp::propagate_on_container_swap>::type>
- : true_type {};
-
-template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
-struct __propagate_on_container_swap
-{
- typedef false_type type;
-};
-
-template <class _Alloc>
-struct __propagate_on_container_swap<_Alloc, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type;
-};
-
-template <class _Tp, class = void>
-struct __has_is_always_equal : false_type {};
-
-template <class _Tp>
-struct __has_is_always_equal<_Tp,
- typename __void_t<typename _Tp::is_always_equal>::type>
- : true_type {};
-
-template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
-struct __is_always_equal
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type;
-};
-
-template <class _Alloc>
-struct __is_always_equal<_Alloc, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type;
-};
+template <class _Tp> class allocator;
-template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
-struct __has_rebind_other
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+template <>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void>
{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Xp> static __two __test(...);
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
-
-template <class _Tp, class _Up>
-struct __has_rebind_other<_Tp, _Up, false>
-{
- static const bool value = false;
-};
-
-template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
-struct __allocator_traits_rebind
-{
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
-};
-
-template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
-struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
-{
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
-};
-
-template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
-struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
-{
- typedef _LIBCPP_NODEBUG_TYPE _Alloc<_Up, _Args...> type;
-};
-
-#ifndef _LIBCPP_CXX03_LANG
-
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Alloc, class _SizeType, class _ConstVoidPtr>
-auto
-__has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
- -> decltype((void)__a.allocate(__sz, __p), true_type());
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
-template <class _Alloc, class _SizeType, class _ConstVoidPtr>
-auto
-__has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
- -> false_type;
-
-template <class _Alloc, class _SizeType, class _ConstVoidPtr>
-struct __has_allocate_hint
- : decltype(_VSTD::__has_allocate_hint_test(declval<_Alloc>(),
- declval<_SizeType>(),
- declval<_ConstVoidPtr>()))
-{
-};
-
-#else // _LIBCPP_CXX03_LANG
-
-template <class _Alloc, class _SizeType, class _ConstVoidPtr>
-struct __has_allocate_hint
- : true_type
-{
-};
-
-#endif // _LIBCPP_CXX03_LANG
-
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Alloc, class ..._Args,
- class = decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Args>()...))>
-static true_type __test_has_construct(int);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
-template <class _Alloc, class...>
-static false_type __test_has_construct(...);
-
-template <class _Alloc, class ..._Args>
-struct __has_construct : decltype(__test_has_construct<_Alloc, _Args...>(0)) {};
-
-#if !defined(_LIBCPP_CXX03_LANG)
-
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Alloc, class _Pointer>
-auto
-__has_destroy_test(_Alloc&& __a, _Pointer&& __p)
- -> decltype(__a.destroy(__p), true_type());
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
-template <class _Alloc, class _Pointer>
-auto
-__has_destroy_test(const _Alloc& __a, _Pointer&& __p)
- -> false_type;
-
-template <class _Alloc, class _Pointer>
-struct __has_destroy
- : decltype(_VSTD::__has_destroy_test(declval<_Alloc>(),
- declval<_Pointer>()))
-{
-};
-
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Alloc>
-auto
-__has_max_size_test(_Alloc&& __a)
- -> decltype(__a.max_size(), true_type());
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
-template <class _Alloc>
-auto
-__has_max_size_test(const volatile _Alloc& __a)
- -> false_type;
-
-template <class _Alloc>
-struct __has_max_size
- : decltype(_VSTD::__has_max_size_test(declval<_Alloc&>()))
-{
-};
-
-template <class _Alloc>
-auto
-__has_select_on_container_copy_construction_test(_Alloc&& __a)
- -> decltype(__a.select_on_container_copy_construction(), true_type());
-
-template <class _Alloc>
-auto
-__has_select_on_container_copy_construction_test(const volatile _Alloc& __a)
- -> false_type;
-
-template <class _Alloc>
-struct __has_select_on_container_copy_construction
- : decltype(_VSTD::__has_select_on_container_copy_construction_test(declval<_Alloc&>()))
-{
-};
-
-#else // _LIBCPP_CXX03_LANG
-
-template <class _Alloc, class _Pointer, class = void>
-struct __has_destroy : false_type {};
-
-template <class _Alloc, class _Pointer>
-struct __has_destroy<_Alloc, _Pointer, typename __void_t<
- decltype(_VSTD::declval<_Alloc>().destroy(_VSTD::declval<_Pointer>()))
->::type> : true_type {};
-
-template <class _Alloc>
-struct __has_max_size
- : true_type
-{
-};
-
-template <class _Alloc>
-struct __has_select_on_container_copy_construction
- : false_type
-{
-};
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Alloc, class _Ptr, bool = __has_
diff erence_type<_Alloc>::value>
-struct __alloc_traits_
diff erence_type
-{
- typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::
diff erence_type type;
-};
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
-template <class _Alloc, class _Ptr>
-struct __alloc_traits_
diff erence_type<_Alloc, _Ptr, true>
-{
- typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::
diff erence_type type;
+ template <class _Up> struct rebind {typedef allocator<_Up> other;};
};
-template <class _Tp>
-struct __is_default_allocator : false_type {};
-
-template <class _Tp>
-struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {};
-
-
-
-template <class _Alloc,
- bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value
- >
-struct __is_cpp17_move_insertable;
-template <class _Alloc>
-struct __is_cpp17_move_insertable<_Alloc, true> : true_type {};
-template <class _Alloc>
-struct __is_cpp17_move_insertable<_Alloc, false> : is_move_constructible<typename _Alloc::value_type> {};
-
-template <class _Alloc,
- bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value
- >
-struct __is_cpp17_copy_insertable;
-template <class _Alloc>
-struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {};
-template <class _Alloc>
-struct __is_cpp17_copy_insertable<_Alloc, false> : integral_constant<bool,
- is_copy_constructible<typename _Alloc::value_type>::value &&
- __is_cpp17_move_insertable<_Alloc>::value>
- {};
-
-
-
-template <class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS allocator_traits
+template <>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<const void>
{
- typedef _Alloc allocator_type;
- typedef typename allocator_type::value_type value_type;
-
- typedef typename __pointer_type<value_type, allocator_type>::type pointer;
- typedef typename __const_pointer<value_type, pointer, allocator_type>::type const_pointer;
- typedef typename __void_pointer<pointer, allocator_type>::type void_pointer;
- typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer;
-
- typedef typename __alloc_traits_
diff erence_type<allocator_type, pointer>::type
diff erence_type;
- typedef typename __size_type<allocator_type,
diff erence_type>::type size_type;
-
- typedef typename __propagate_on_container_copy_assignment<allocator_type>::type
- propagate_on_container_copy_assignment;
- typedef typename __propagate_on_container_move_assignment<allocator_type>::type
- propagate_on_container_move_assignment;
- typedef typename __propagate_on_container_swap<allocator_type>::type
- propagate_on_container_swap;
- typedef typename __is_always_equal<allocator_type>::type
- is_always_equal;
-
-#ifndef _LIBCPP_CXX03_LANG
- template <class _Tp> using rebind_alloc =
- typename __allocator_traits_rebind<allocator_type, _Tp>::type;
- template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
-#else // _LIBCPP_CXX03_LANG
- template <class _Tp> struct rebind_alloc
- {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;};
- template <class _Tp> struct rebind_traits
- {typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;};
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static pointer allocate(allocator_type& __a, size_type __n)
- {return __a.allocate(__n);}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
- {return __allocate(__a, __n, __hint,
- __has_allocate_hint<allocator_type, size_type, const_void_pointer>());}
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT
- {__a.deallocate(__p, __n);}
-
- template <class _Tp, class... _Args>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
- {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
- __a, __p, _VSTD::forward<_Args>(__args)...);}
-
- template <class _Tp>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static void destroy(allocator_type& __a, _Tp* __p)
- {__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static size_type max_size(const allocator_type& __a) _NOEXCEPT
- {return __max_size(__has_max_size<const allocator_type>(), __a);}
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static allocator_type
- select_on_container_copy_construction(const allocator_type& __a)
- {return __select_on_container_copy_construction(
- __has_select_on_container_copy_construction<const allocator_type>(),
- __a);}
-
-private:
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static pointer __allocate(allocator_type& __a, size_type __n,
- const_void_pointer __hint, true_type)
- {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- return __a.allocate(__n, __hint);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static pointer __allocate(allocator_type& __a, size_type __n,
- const_void_pointer, false_type)
- {return __a.allocate(__n);}
-
- template <class _Tp, class... _Args>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args)
- {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __a.construct(__p, _VSTD::forward<_Args>(__args)...);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
-
- template <class _Tp, class... _Args>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args)
- {
-#if _LIBCPP_STD_VER > 17
- _VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...);
-#else
- ::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...);
-#endif
- }
-
- template <class _Tp>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static void __destroy(true_type, allocator_type& __a, _Tp* __p)
- {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __a.destroy(__p);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Tp>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static void __destroy(false_type, allocator_type&, _Tp* __p)
- {
-#if _LIBCPP_STD_VER > 17
- _VSTD::destroy_at(__p);
-#else
- __p->~_Tp();
-#endif
- }
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static size_type __max_size(true_type, const allocator_type& __a) _NOEXCEPT
- {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- return __a.max_size();
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static size_type __max_size(false_type, const allocator_type&) _NOEXCEPT
- {return numeric_limits<size_type>::max() / sizeof(value_type);}
+public:
+ typedef const void* pointer;
+ typedef const void* const_pointer;
+ typedef const void value_type;
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static allocator_type
- __select_on_container_copy_construction(true_type, const allocator_type& __a)
- {return __a.select_on_container_copy_construction();}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
- static allocator_type
- __select_on_container_copy_construction(false_type, const allocator_type& __a)
- {return __a;}
+ template <class _Up> struct rebind {typedef allocator<_Up> other;};
};
-
-template <class _Traits, class _Tp>
-struct __rebind_alloc_helper
-{
-#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG_TYPE typename _Traits::template rebind_alloc<_Tp> type;
-#else
- typedef typename _Traits::template rebind_alloc<_Tp>::other type;
#endif
-};
// allocator
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 3bcb1d74fcad..c1633f19c51f 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -595,75 +595,6 @@ using __is_primary_template = _IsValidExpansion<
__test_for_primary_template, _Tp
>;
-// addressof
-#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
-
-template <class _Tp>
-inline _LIBCPP_CONSTEXPR_AFTER_CXX14
-_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
-_Tp*
-addressof(_Tp& __x) _NOEXCEPT
-{
- return __builtin_addressof(__x);
-}
-
-#else
-
-template <class _Tp>
-inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
-_Tp*
-addressof(_Tp& __x) _NOEXCEPT
-{
- return reinterpret_cast<_Tp *>(
- const_cast<char *>(&reinterpret_cast<const volatile char &>(__x)));
-}
-
-#endif // _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
-
-#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
-// Objective-C++ Automatic Reference Counting uses qualified pointers
-// that require special addressof() signatures. When
-// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
-// itself is providing these definitions. Otherwise, we provide them.
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__strong _Tp*
-addressof(__strong _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-
-#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__weak _Tp*
-addressof(__weak _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-#endif
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__autoreleasing _Tp*
-addressof(__autoreleasing _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__unsafe_unretained _Tp*
-addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-#endif
-
-#if !defined(_LIBCPP_CXX03_LANG)
-template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
-#endif
-
struct __two {char __lx[2];};
// helper class:
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
index 17becf2e5a28..65046a4aec34 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
@@ -22,6 +22,6 @@ struct move_only
int main(int, char**)
{
std::vector<move_only> v;
- std::vector<move_only> copy = v; // expected-error-re at memory:* {{{{(no matching function for call to 'construct_at')|(call to implicitly-deleted copy constructor of 'move_only')}}}}
+ std::vector<move_only> copy = v; // expected-error-re@* {{{{(no matching function for call to 'construct_at')|(call to implicitly-deleted copy constructor of 'move_only')}}}}
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
index 984af29d31bf..7c2a77b5bdf3 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
@@ -32,11 +32,11 @@ class BadUserNoCookie {
};
int main(int, char**) {
- // expected-error at memory:* 2 {{"The specified type does not meet the requirements of Cpp17MoveInsertable"}}
+ // expected-error@* 2 {{"The specified type does not meet the requirements of Cpp17MoveInsertable"}}
// Other diagnostics that might be seen as Clang tries to continue compiling:
- // expected-error at memory:* 0-2 {{call to deleted constructor}}
- // expected-error at memory:* 0-2 {{no matching function for call to 'construct_at'}}
+ // expected-error@* 0-2 {{call to deleted constructor}}
+ // expected-error@* 0-2 {{no matching function for call to 'construct_at'}}
{
std::vector<BadUserNoCookie<1> > x;
More information about the libcxx-commits
mailing list