aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/list
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/list')
-rw-r--r--libcxx/include/list67
1 files changed, 43 insertions, 24 deletions
diff --git a/libcxx/include/list b/libcxx/include/list
index 5fcbd67c6703..a0c732739ca2 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -194,21 +194,24 @@ template <class T, class Allocator, class Predicate>
#include <__iterator/next.h>
#include <__iterator/prev.h>
#include <__iterator/reverse_iterator.h>
+#include <__memory/addressof.h>
+#include <__memory/allocator.h>
+#include <__memory/allocator_destructor.h>
+#include <__memory/allocator_traits.h>
+#include <__memory/compressed_pair.h>
+#include <__memory/pointer_traits.h>
#include <__memory/swap_allocator.h>
+#include <__memory/unique_ptr.h>
+#include <__memory_resource/polymorphic_allocator.h>
+#include <__type_traits/is_allocator.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
+#include <cstring>
#include <limits>
-#include <memory>
#include <type_traits>
#include <version>
-#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
-# include <algorithm>
-# include <functional>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -237,26 +240,19 @@ template <class _Tp, class _VoidPtr> struct __list_node_base;
template <class _Tp, class _VoidPtr>
struct __list_node_pointer_traits {
- typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
+ typedef __rebind_pointer_t<_VoidPtr, __list_node<_Tp, _VoidPtr> >
__node_pointer;
- typedef typename __rebind_pointer<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >::type
+ typedef __rebind_pointer_t<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >
__base_pointer;
#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB)
typedef __base_pointer __link_pointer;
#else
- typedef typename conditional<
- is_pointer<_VoidPtr>::value,
- __base_pointer,
- __node_pointer
- >::type __link_pointer;
+ typedef __conditional_t<is_pointer<_VoidPtr>::value, __base_pointer, __node_pointer> __link_pointer;
#endif
- typedef typename conditional<
- is_same<__link_pointer, __node_pointer>::value,
- __base_pointer,
- __node_pointer
- >::type __non_link_pointer;
+ typedef __conditional_t<is_same<__link_pointer, __node_pointer>::value, __base_pointer, __node_pointer>
+ __non_link_pointer;
static _LIBCPP_INLINE_VISIBILITY
__link_pointer __unsafe_link_pointer_cast(__link_pointer __p) {
@@ -340,7 +336,7 @@ public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef value_type& reference;
- typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer;
+ typedef __rebind_pointer_t<_VoidPtr, value_type> pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
@@ -448,7 +444,7 @@ public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef const value_type& reference;
- typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer;
+ typedef __rebind_pointer_t<_VoidPtr, const value_type> pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
@@ -555,7 +551,7 @@ protected:
typedef __list_const_iterator<value_type, __void_pointer> const_iterator;
typedef __list_node_base<value_type, __void_pointer> __node_base;
typedef __list_node<value_type, __void_pointer> __node;
- typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
+ typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
typedef allocator_traits<__node_allocator> __node_alloc_traits;
typedef typename __node_alloc_traits::pointer __node_pointer;
typedef typename __node_alloc_traits::pointer __node_const_pointer;
@@ -566,7 +562,7 @@ protected:
typedef typename __alloc_traits::const_pointer const_pointer;
typedef typename __alloc_traits::difference_type difference_type;
- typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator;
+ typedef __rebind_alloc<__alloc_traits, __node_base> __node_base_allocator;
typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
static_assert((!is_same<allocator_type, __node_allocator>::value),
"internal allocator type must differ from user-specified "
@@ -845,6 +841,10 @@ public:
typedef void __remove_return_type;
#endif
+ static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
_LIBCPP_INLINE_VISIBILITY
list()
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
@@ -1063,7 +1063,7 @@ public:
__remove_return_type remove(const value_type& __x);
template <class _Pred> __remove_return_type remove_if(_Pred __pred);
_LIBCPP_INLINE_VISIBILITY
- __remove_return_type unique() { return unique(__equal_to<value_type>()); }
+ __remove_return_type unique() { return unique(__equal_to()); }
template <class _BinaryPred>
__remove_return_type unique(_BinaryPred __binary_pred);
_LIBCPP_INLINE_VISIBILITY
@@ -2362,6 +2362,25 @@ inline constexpr bool __format::__enable_insertable<std::list<wchar_t>> = true;
_LIBCPP_END_NAMESPACE_STD
+#if _LIBCPP_STD_VER > 14
+_LIBCPP_BEGIN_NAMESPACE_STD
+namespace pmr {
+template <class _ValueT>
+using list = std::list<_ValueT, polymorphic_allocator<_ValueT>>;
+} // namespace pmr
+_LIBCPP_END_NAMESPACE_STD
+#endif
+
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <atomic>
+# include <concepts>
+# include <functional>
+# include <iosfwd>
+# include <iterator>
+# include <typeinfo>
+#endif
+
#endif // _LIBCPP_LIST