mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-06 01:22:41 +00:00
[libc++] Rework compressed pair constructors.
This patch de-duplicates most compressed pair constructors to use the same code in C++11 and C++03. Part of doing that is deleting the "__second_tag()" and replacing it with a "__value_init_tag()" which has the same effect, but allows for the removal of the special "one-arg" first element constructor. This patch is intended to have no semantic change.
This commit is contained in:
parent
f63b64c0c3
commit
549545b64a
@ -104,7 +104,7 @@ class __func<_Fp, _Alloc, _Rp()>
|
||||
{
|
||||
__compressed_pair<_Fp, _Alloc> __f_;
|
||||
public:
|
||||
explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
|
||||
explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
|
||||
explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_Rp()>* __clone() const;
|
||||
virtual void __clone(__base<_Rp()>*) const;
|
||||
@ -189,7 +189,7 @@ class __func<_Fp, _Alloc, _Rp(_A0)>
|
||||
{
|
||||
__compressed_pair<_Fp, _Alloc> __f_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
|
||||
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_Rp(_A0)>* __clone() const;
|
||||
@ -275,7 +275,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1)>
|
||||
{
|
||||
__compressed_pair<_Fp, _Alloc> __f_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
|
||||
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_Rp(_A0, _A1)>* __clone() const;
|
||||
@ -361,7 +361,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>
|
||||
{
|
||||
__compressed_pair<_Fp, _Alloc> __f_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
|
||||
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const;
|
||||
|
@ -776,7 +776,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __data_(0) {}
|
||||
: __data_(0, __default_init_tag()) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator(const allocator_type& __a, size_type __size)
|
||||
@ -1418,8 +1418,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
|
||||
is_nothrow_default_constructible<__node_allocator>::value &&
|
||||
is_nothrow_default_constructible<hasher>::value &&
|
||||
is_nothrow_default_constructible<key_equal>::value)
|
||||
: __p2_(0),
|
||||
__p3_(1.0f)
|
||||
: __p2_(0, __default_init_tag()),
|
||||
__p3_(1.0f, __default_init_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -1439,7 +1439,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
|
||||
const key_equal& __eql,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p1_(__default_init_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __hf),
|
||||
__p3_(1.0f, __eql)
|
||||
{
|
||||
@ -1448,9 +1448,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0),
|
||||
__p3_(1.0f)
|
||||
__p1_(__default_init_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __default_init_tag()),
|
||||
__p3_(1.0f, __default_init_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -1460,7 +1460,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
|
||||
__bucket_list_deleter(allocator_traits<__pointer_allocator>::
|
||||
select_on_container_copy_construction(
|
||||
__u.__bucket_list_.get_deleter().__alloc()), 0)),
|
||||
__p1_(__second_tag(), allocator_traits<__node_allocator>::
|
||||
__p1_(__default_init_tag(), allocator_traits<__node_allocator>::
|
||||
select_on_container_copy_construction(__u.__node_alloc())),
|
||||
__p2_(0, __u.hash_function()),
|
||||
__p3_(__u.__p3_)
|
||||
@ -1471,7 +1471,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p1_(__default_init_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __u.hash_function()),
|
||||
__p3_(__u.__p3_)
|
||||
{
|
||||
@ -1505,7 +1505,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p1_(__default_init_tag(), __node_allocator(__a)),
|
||||
__p2_(0, _VSTD::move(__u.hash_function())),
|
||||
__p3_(_VSTD::move(__u.__p3_))
|
||||
{
|
||||
|
@ -324,7 +324,7 @@ template <class _Tp, class _Allocator>
|
||||
inline
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
|
||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __default_init_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
|
||||
: __end_cap_(__second_tag(), __a)
|
||||
: __end_cap_(nullptr, __a)
|
||||
{
|
||||
if (__a == __c.__alloc())
|
||||
{
|
||||
|
@ -1577,8 +1577,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__second_tag(), __node_allocator(__a)),
|
||||
__pair3_(0)
|
||||
__pair1_(__default_init_tag(), __node_allocator(__a)),
|
||||
__pair3_(0, __default_init_tag())
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
}
|
||||
@ -1587,7 +1587,7 @@ template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
|
||||
const allocator_type& __a)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__second_tag(), __node_allocator(__a)),
|
||||
__pair1_(__default_init_tag(), __node_allocator(__a)),
|
||||
__pair3_(0, __comp)
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
@ -1700,7 +1700,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
|
||||
__pair1_(__default_init_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
|
||||
__pair3_(0, __t.value_comp())
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
@ -1730,7 +1730,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
|
||||
: __pair1_(__second_tag(), __node_allocator(__a)),
|
||||
: __pair1_(__default_init_tag(), __node_allocator(__a)),
|
||||
__pair3_(0, _VSTD::move(__t.value_comp()))
|
||||
{
|
||||
if (__a == __t.__alloc())
|
||||
|
@ -1171,7 +1171,7 @@ template <class _Tp, class _Allocator>
|
||||
inline
|
||||
__deque_base<_Tp, _Allocator>::__deque_base()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __start_(0), __size_(0) {}
|
||||
: __start_(0), __size_(0, __default_init_tag()) {}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline
|
||||
|
@ -490,7 +490,7 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
: __before_begin_(__begin_node()) {}
|
||||
: __before_begin_(__begin_node(), __default_init_tag()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __forward_list_base(const allocator_type& __a)
|
||||
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
|
||||
|
@ -1767,9 +1767,9 @@ class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgType
|
||||
__compressed_pair<_Fp, _Alloc> __f_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __packaged_task_func(const _Fp& __f) : __f_(__f) {}
|
||||
explicit __packaged_task_func(const _Fp& __f) : __f_(__f, __default_init_tag()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__packaged_task_func(const _Fp& __f, const _Alloc& __a)
|
||||
: __f_(__f, __a) {}
|
||||
|
@ -715,7 +715,7 @@ template <class _Tp, class _Alloc>
|
||||
inline
|
||||
__list_imp<_Tp, _Alloc>::__list_imp()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
: __size_alloc_(0)
|
||||
: __size_alloc_(0, __default_init_tag())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2180,6 +2180,7 @@ public:
|
||||
|
||||
// Tag used to default initialize one or both of the pair's elements.
|
||||
struct __default_init_tag {};
|
||||
struct __value_init_tag {};
|
||||
|
||||
template <class _Tp, int _Idx,
|
||||
bool _CanBeEmptyBase =
|
||||
@ -2189,34 +2190,31 @@ struct __compressed_pair_elem {
|
||||
typedef _Tp& reference;
|
||||
typedef const _Tp& const_reference;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() : __value_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
__compressed_pair_elem(__default_init_tag) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
__compressed_pair_elem(__value_init_tag) : __value_() {}
|
||||
|
||||
template <class _Up, class = typename enable_if<
|
||||
!is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr explicit
|
||||
_LIBCPP_CONSTEXPR explicit
|
||||
__compressed_pair_elem(_Up&& __u)
|
||||
: __value_(_VSTD::forward<_Up>(__u))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class... _Args, size_t... _Indexes>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
__compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
|
||||
__tuple_indices<_Indexes...>)
|
||||
: __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY __compressed_pair_elem() : __value_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__compressed_pair_elem(__default_init_tag) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__compressed_pair_elem(_ParamT __p) : __value_(std::forward<_ParamT>(__p)) {}
|
||||
#endif
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return __value_; }
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference __get() const _NOEXCEPT { return __value_; }
|
||||
@ -2232,28 +2230,27 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
|
||||
typedef const _Tp& const_reference;
|
||||
typedef _Tp __value_type;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() = default;
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair_elem() = default;
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
__compressed_pair_elem(__default_init_tag) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
__compressed_pair_elem(__value_init_tag) : __value_type() {}
|
||||
|
||||
template <class _Up, class = typename enable_if<
|
||||
!is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr explicit
|
||||
_LIBCPP_CONSTEXPR explicit
|
||||
__compressed_pair_elem(_Up&& __u)
|
||||
: __value_type(_VSTD::forward<_Up>(__u))
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class... _Args, size_t... _Indexes>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
__compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
|
||||
__tuple_indices<_Indexes...>)
|
||||
: __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY __compressed_pair_elem() : __value_type() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__compressed_pair_elem(_ParamT __p)
|
||||
: __value_type(std::forward<_ParamT>(__p)) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return *this; }
|
||||
@ -2261,9 +2258,6 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
|
||||
const_reference __get() const _NOEXCEPT { return *this; }
|
||||
};
|
||||
|
||||
// Tag used to construct the second element of the compressed pair.
|
||||
struct __second_tag {};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
|
||||
private __compressed_pair_elem<_T2, 1> {
|
||||
@ -2280,33 +2274,21 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
|
||||
"implementation for this configuration");
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <bool _Dummy = true,
|
||||
template <bool _Dummy = true,
|
||||
class = typename enable_if<
|
||||
__dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
|
||||
__dependent_type<is_default_constructible<_T2>, _Dummy>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __compressed_pair() {}
|
||||
|
||||
template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type,
|
||||
__compressed_pair>::value,
|
||||
bool>::type = true>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr explicit
|
||||
__compressed_pair(_Tp&& __t)
|
||||
: _Base1(std::forward<_Tp>(__t)), _Base2() {}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
__compressed_pair(__second_tag, _Tp&& __t)
|
||||
: _Base1(), _Base2(std::forward<_Tp>(__t)) {}
|
||||
_LIBCPP_CONSTEXPR __compressed_pair() : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {}
|
||||
|
||||
template <class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
__compressed_pair(_U1&& __t1, _U2&& __t2)
|
||||
: _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class... _Args1, class... _Args2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
__compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
|
||||
@ -2315,21 +2297,6 @@ public:
|
||||
typename __make_tuple_indices<sizeof...(_Args1)>::type()),
|
||||
_Base2(__pc, _VSTD::move(__second_args),
|
||||
typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}
|
||||
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__compressed_pair() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY explicit
|
||||
__compressed_pair(_T1 __t1) : _Base1(_VSTD::forward<_T1>(__t1)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__compressed_pair(__second_tag, _T2 __t2)
|
||||
: _Base1(), _Base2(_VSTD::forward<_T2>(__t2)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__compressed_pair(_T1 __t1, _T2 __t2)
|
||||
: _Base1(_VSTD::forward<_T1>(__t1)), _Base2(_VSTD::forward<_T2>(__t2)) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -2510,17 +2477,17 @@ public:
|
||||
template <bool _Dummy = true,
|
||||
class = _EnableIfDeleterDefaultConstructible<_Dummy> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
|
||||
_LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
|
||||
|
||||
template <bool _Dummy = true,
|
||||
class = _EnableIfDeleterDefaultConstructible<_Dummy> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}
|
||||
_LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
|
||||
|
||||
template <bool _Dummy = true,
|
||||
class = _EnableIfDeleterDefaultConstructible<_Dummy> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||
explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __default_init_tag()) {}
|
||||
|
||||
template <bool _Dummy = true,
|
||||
class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
|
||||
@ -2562,7 +2529,7 @@ public:
|
||||
typename enable_if<is_convertible<_Up*, _Tp*>::value &&
|
||||
is_same<_Dp, default_delete<_Tp> >::value,
|
||||
__nat>::type = __nat()) _NOEXCEPT
|
||||
: __ptr_(__p.release()) {}
|
||||
: __ptr_(__p.release(), __default_init_tag()) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -2733,19 +2700,19 @@ public:
|
||||
template <bool _Dummy = true,
|
||||
class = _EnableIfDeleterDefaultConstructible<_Dummy> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
|
||||
_LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
|
||||
|
||||
template <bool _Dummy = true,
|
||||
class = _EnableIfDeleterDefaultConstructible<_Dummy> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}
|
||||
_LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
|
||||
|
||||
template <class _Pp, bool _Dummy = true,
|
||||
class = _EnableIfDeleterDefaultConstructible<_Dummy>,
|
||||
class = _EnableIfPointerConvertible<_Pp> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit unique_ptr(_Pp __p) _NOEXCEPT
|
||||
: __ptr_(__p) {}
|
||||
: __ptr_(__p, __default_init_tag()) {}
|
||||
|
||||
template <class _Pp, bool _Dummy = true,
|
||||
class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,
|
||||
@ -3589,24 +3556,20 @@ class __shared_ptr_emplace
|
||||
{
|
||||
__compressed_pair<_Alloc, _Tp> __data_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__shared_ptr_emplace(_Alloc __a)
|
||||
: __data_(_VSTD::move(__a)) {}
|
||||
: __data_(_VSTD::move(__a), __value_init_tag()) {}
|
||||
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
|
||||
: __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__shared_ptr_emplace(_Alloc __a)
|
||||
: __data_(__a) {}
|
||||
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__shared_ptr_emplace(_Alloc __a, _A0& __a0)
|
||||
|
@ -1736,7 +1736,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
|
||||
#else
|
||||
_NOEXCEPT
|
||||
#endif
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_c(this);
|
||||
@ -1796,7 +1796,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
template <class>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
|
||||
__init(__s, traits_type::length(__s));
|
||||
@ -1819,7 +1819,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
|
||||
__init(__s, __n);
|
||||
@ -1830,7 +1830,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
|
||||
: __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
|
||||
: __r_(__value_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
|
||||
{
|
||||
if (!__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
@ -1844,7 +1844,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
const basic_string& __str, const allocator_type& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
if (!__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
@ -1878,7 +1878,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
|
||||
__init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
|
||||
@ -1933,7 +1933,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
template <class>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
__init(__n, __c);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -1945,7 +1945,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
|
||||
size_type __pos, size_type __n,
|
||||
const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
size_type __str_sz = __str.size();
|
||||
if (__pos > __str_sz)
|
||||
@ -1960,7 +1960,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
|
||||
const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
size_type __str_sz = __str.size();
|
||||
if (__pos > __str_sz)
|
||||
@ -1975,7 +1975,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
template <class _Tp, class>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
__self_view __sv0 = __t;
|
||||
__self_view __sv = __sv0.substr(__pos, __n);
|
||||
@ -1999,7 +1999,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
template <class _Tp, class>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
__self_view __sv = __t;
|
||||
__init(__sv.data(), __sv.size());
|
||||
@ -2082,7 +2082,7 @@ template<class _InputIterator, class>
|
||||
inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
|
||||
const allocator_type& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
__init(__first, __last);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -2108,7 +2108,7 @@ inline
|
||||
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
initializer_list<_CharT> __il, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
: __r_(__value_init_tag(), __a)
|
||||
{
|
||||
__init(__il.begin(), __il.end());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
@ -433,7 +433,7 @@ __vector_base<_Tp, _Allocator>::__vector_base()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr),
|
||||
__end_cap_(nullptr)
|
||||
__end_cap_(nullptr, __default_init_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -2622,7 +2622,7 @@ vector<bool, _Allocator>::vector()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __begin_(nullptr),
|
||||
__size_(0),
|
||||
__cap_alloc_(0)
|
||||
__cap_alloc_(0, __default_init_tag())
|
||||
{
|
||||
}
|
||||
|
||||
@ -2644,7 +2644,7 @@ template <class _Allocator>
|
||||
vector<bool, _Allocator>::vector(size_type __n)
|
||||
: __begin_(nullptr),
|
||||
__size_(0),
|
||||
__cap_alloc_(0)
|
||||
__cap_alloc_(0, __default_init_tag())
|
||||
{
|
||||
if (__n > 0)
|
||||
{
|
||||
@ -2672,7 +2672,7 @@ template <class _Allocator>
|
||||
vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
|
||||
: __begin_(nullptr),
|
||||
__size_(0),
|
||||
__cap_alloc_(0)
|
||||
__cap_alloc_(0, __default_init_tag())
|
||||
{
|
||||
if (__n > 0)
|
||||
{
|
||||
@ -2701,7 +2701,7 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
|
||||
!__is_cpp17_forward_iterator<_InputIterator>::value>::type*)
|
||||
: __begin_(nullptr),
|
||||
__size_(0),
|
||||
__cap_alloc_(0)
|
||||
__cap_alloc_(0, __default_init_tag())
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
@ -2754,7 +2754,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
|
||||
typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type*)
|
||||
: __begin_(nullptr),
|
||||
__size_(0),
|
||||
__cap_alloc_(0)
|
||||
__cap_alloc_(0, __default_init_tag())
|
||||
{
|
||||
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
|
||||
if (__n > 0)
|
||||
@ -2786,7 +2786,7 @@ template <class _Allocator>
|
||||
vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
|
||||
: __begin_(nullptr),
|
||||
__size_(0),
|
||||
__cap_alloc_(0)
|
||||
__cap_alloc_(0, __default_init_tag())
|
||||
{
|
||||
size_type __n = static_cast<size_type>(__il.size());
|
||||
if (__n > 0)
|
||||
|
@ -52,7 +52,7 @@ int main(int, char**) {
|
||||
// FIXME: It would be great to suppress the below diagnostic all together.
|
||||
// but for now it's sufficient that it appears last. However there is
|
||||
// currently no way to test the order diagnostics are issued.
|
||||
// expected-error@memory:* {{call to implicitly-deleted default constructor of '__compressed_pair_elem}}
|
||||
// expected-error@memory:* {{call to implicitly-deleted default constructor of 'std::}}
|
||||
}
|
||||
{
|
||||
using Set = std::unordered_set<int, BadHashNoCopy>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user