summaryrefslogtreecommitdiff
path: root/include/memory
diff options
context:
space:
mode:
Diffstat (limited to 'include/memory')
-rw-r--r--include/memory177
1 files changed, 132 insertions, 45 deletions
diff --git a/include/memory b/include/memory
index 22311aaace92..65369d2632c4 100644
--- a/include/memory
+++ b/include/memory
@@ -612,7 +612,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <cassert>
#endif
-#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
@@ -932,6 +932,15 @@ public:
{return _VSTD::addressof(__r);}
};
+template <class _From, class _To>
+struct __rebind_pointer {
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+ typedef typename pointer_traits<_From>::template rebind<_To> type;
+#else
+ typedef typename pointer_traits<_From>::template rebind<_To>::other type;
+#endif
+};
+
// allocator_traits
namespace __has_pointer_type_imp
@@ -1669,7 +1678,7 @@ private:
{return __a.max_size();}
_LIBCPP_INLINE_VISIBILITY
static size_type __max_size(false_type, const allocator_type&)
- {return numeric_limits<size_type>::max();}
+ {return numeric_limits<size_type>::max() / sizeof(value_type);}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
@@ -1900,6 +1909,10 @@ public:
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
{::new(&*__x_) _Tp(__element); return *this;}
+#if _LIBCPP_STD_VER >= 14
+ _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
+ {::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
+#endif
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int)
{raw_storage_iterator __t(*this); ++__x_; return __t;}
@@ -2659,10 +2672,17 @@ public:
: __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
template <class _Up, class _Ep>
- _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr<_Up, _Ep> __u)
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<
+ !is_array<_Up>::value &&
+ is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
+ is_assignable<deleter_type&, _Ep&>::value,
+ unique_ptr&
+ >::type
+ operator=(unique_ptr<_Up, _Ep> __u)
{
reset(__u.release());
- __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
+ __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
return *this;
}
@@ -3420,7 +3440,7 @@ struct __scalar_hash<_Tp, 2>
{
size_t __a;
size_t __b;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@@ -3442,7 +3462,7 @@ struct __scalar_hash<_Tp, 3>
size_t __a;
size_t __b;
size_t __c;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@@ -3465,7 +3485,7 @@ struct __scalar_hash<_Tp, 4>
size_t __b;
size_t __c;
size_t __d;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@@ -3854,7 +3874,9 @@ private:
struct __nat {int __for_bool_;};
public:
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
template<class _Yp>
explicit shared_ptr(_Yp* __p,
@@ -3867,15 +3889,18 @@ public:
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a);
- template<class _Yp> shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr(const shared_ptr& __r) _NOEXCEPT;
template<class _Yp>
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr(const shared_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
_NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr(shared_ptr&& __r) _NOEXCEPT;
- template<class _Yp> shared_ptr(shared_ptr<_Yp>&& __r,
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
_NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -3932,6 +3957,7 @@ public:
~shared_ptr();
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -3939,8 +3965,10 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -3948,6 +3976,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr<_Tp>&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp>&& __r);
template<class _Yp>
typename enable_if
@@ -3956,6 +3985,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr
>::type&
+ _LIBCPP_INLINE_VISIBILITY
operator=(auto_ptr<_Yp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp>
@@ -3965,6 +3995,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(auto_ptr<_Yp> __r);
#endif
template <class _Yp, class _Dp>
@@ -3975,12 +4006,16 @@ public:
shared_ptr&
>::type
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
operator=(unique_ptr<_Yp, _Dp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
operator=(unique_ptr<_Yp, _Dp> __r);
#endif
+ _LIBCPP_INLINE_VISIBILITY
void swap(shared_ptr& __r) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void reset() _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -3988,6 +4023,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p);
template<class _Yp, class _Dp>
typename enable_if
@@ -3995,6 +4031,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p, _Dp __d);
template<class _Yp, class _Dp, class _Alloc>
typename enable_if
@@ -4002,6 +4039,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p, _Dp __d, _Alloc __a);
_LIBCPP_INLINE_VISIBILITY
@@ -4103,7 +4141,7 @@ private:
};
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
: __ptr_(0),
@@ -4112,7 +4150,7 @@ shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
: __ptr_(0),
@@ -4235,7 +4273,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEXCEPT
: __ptr_(__p),
__cntrl_(__r.__cntrl_)
@@ -4245,7 +4283,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEX
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@@ -4256,7 +4294,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
_NOEXCEPT
@@ -4270,7 +4308,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@@ -4281,7 +4319,7 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
_NOEXCEPT
@@ -4568,7 +4606,7 @@ shared_ptr<_Tp>::~shared_ptr()
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
{
@@ -4578,7 +4616,7 @@ shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -4593,7 +4631,7 @@ shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
{
@@ -4603,7 +4641,7 @@ shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -4617,7 +4655,7 @@ shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r)
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
!is_array<_Yp>::value &&
@@ -4632,7 +4670,7 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
template<class _Tp>
template <class _Yp, class _Dp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
!is_array<_Yp>::value &&
@@ -4680,7 +4718,7 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
{
@@ -4689,7 +4727,7 @@ shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
shared_ptr<_Tp>::reset() _NOEXCEPT
{
@@ -4698,7 +4736,7 @@ shared_ptr<_Tp>::reset() _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -4711,7 +4749,7 @@ shared_ptr<_Tp>::reset(_Yp* __p)
template<class _Tp>
template<class _Yp, class _Dp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -4724,7 +4762,7 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d)
template<class _Tp>
template<class _Yp, class _Dp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -5041,23 +5079,27 @@ private:
__shared_weak_count* __cntrl_;
public:
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
- template<class _Yp> weak_ptr(shared_ptr<_Yp> const& __r,
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
weak_ptr(weak_ptr const& __r) _NOEXCEPT;
- template<class _Yp> weak_ptr(weak_ptr<_Yp> const& __r,
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
weak_ptr(weak_ptr&& __r) _NOEXCEPT;
- template<class _Yp> weak_ptr(weak_ptr<_Yp>&& __r,
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~weak_ptr();
+ _LIBCPP_INLINE_VISIBILITY
weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -5065,10 +5107,12 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -5076,6 +5120,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -5086,9 +5131,12 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void swap(weak_ptr& __r) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void reset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@@ -5112,7 +5160,7 @@ public:
};
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
: __ptr_(0),
@@ -5121,7 +5169,7 @@ weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@@ -5132,7 +5180,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@@ -5145,7 +5193,7 @@ weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@@ -5159,7 +5207,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@@ -5170,7 +5218,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@@ -5191,7 +5239,7 @@ weak_ptr<_Tp>::~weak_ptr()
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>&
weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
{
@@ -5201,7 +5249,7 @@ weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -5216,7 +5264,7 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>&
weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
{
@@ -5226,7 +5274,7 @@ weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -5242,7 +5290,7 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -5255,7 +5303,7 @@ weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT
{
@@ -5272,7 +5320,7 @@ swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
weak_ptr<_Tp>::reset() _NOEXCEPT
{
@@ -5305,7 +5353,11 @@ weak_ptr<_Tp>::lock() const _NOEXCEPT
return __r;
}
+#if _LIBCPP_STD_VER > 14
+template <class _Tp = void> struct owner_less;
+#else
template <class _Tp> struct owner_less;
+#endif
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY owner_less<shared_ptr<_Tp> >
@@ -5339,6 +5391,30 @@ struct _LIBCPP_TYPE_VIS_ONLY owner_less<weak_ptr<_Tp> >
{return __x.owner_before(__y);}
};
+#if _LIBCPP_STD_VER > 14
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY owner_less<void>
+{
+ template <class _Tp, class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
+ {return __x.owner_before(__y);}
+ template <class _Tp, class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
+ {return __x.owner_before(__y);}
+ template <class _Tp, class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
+ {return __x.owner_before(__y);}
+ template <class _Tp, class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
+ {return __x.owner_before(__y);}
+ typedef void is_transparent;
+};
+#endif
+
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this
{
@@ -5381,7 +5457,9 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
-#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
+// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
+// enabled with clang.
+#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
class _LIBCPP_TYPE_VIS __sp_mut
{
@@ -5507,7 +5585,7 @@ atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v
return atomic_compare_exchange_weak(__p, __v, __w);
}
-#endif // __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
//enum class
struct _LIBCPP_TYPE_VIS pointer_safety
@@ -5574,6 +5652,15 @@ template <typename _Alloc>
_LIBCPP_INLINE_VISIBILITY
void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}
+template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> >
+struct __noexcept_move_assign_container : public integral_constant<bool,
+ _Traits::propagate_on_container_move_assignment::value
+#if _LIBCPP_STD_VER > 14
+ || _Traits::is_always_equal::value
+#else
+ && is_nothrow_move_assignable<_Alloc>::value
+#endif
+ > {};
_LIBCPP_END_NAMESPACE_STD