Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,6 @@ set(files
__type_traits/copy_cvref.h
__type_traits/datasizeof.h
__type_traits/decay.h
__type_traits/dependent_type.h
__type_traits/desugars_to.h
__type_traits/detected_or.h
__type_traits/disjunction.h
Expand Down
115 changes: 40 additions & 75 deletions libcxx/include/__memory/unique_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <__type_traits/add_reference.h>
#include <__type_traits/common_type.h>
#include <__type_traits/conditional.h>
#include <__type_traits/dependent_type.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_array.h>
Expand All @@ -46,7 +45,7 @@
#include <__type_traits/is_unbounded_array.h>
#include <__type_traits/is_void.h>
#include <__type_traits/remove_extent.h>
#include <__type_traits/type_identity.h>
#include <__type_traits/remove_reference.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
#include <__utility/move.h>
Expand Down Expand Up @@ -98,28 +97,6 @@ inline const bool __is_default_deleter_v = false;
template <class _Tp>
inline const bool __is_default_deleter_v<default_delete<_Tp> > = true;

template <class _Deleter>
struct __unique_ptr_deleter_sfinae {
static_assert(!is_reference<_Deleter>::value, "incorrect specialization");
typedef const _Deleter& __lval_ref_type;
typedef _Deleter&& __good_rval_ref_type;
typedef true_type __enable_rval_overload;
};

template <class _Deleter>
struct __unique_ptr_deleter_sfinae<_Deleter const&> {
typedef const _Deleter& __lval_ref_type;
typedef const _Deleter&& __bad_rval_ref_type;
typedef false_type __enable_rval_overload;
};

template <class _Deleter>
struct __unique_ptr_deleter_sfinae<_Deleter&> {
typedef _Deleter& __lval_ref_type;
typedef _Deleter&& __bad_rval_ref_type;
typedef false_type __enable_rval_overload;
};

#if defined(_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI)
# define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__))
#else
Expand Down Expand Up @@ -151,23 +128,9 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr {
private:
_LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_);

using _DeleterSFINAE _LIBCPP_NODEBUG = __unique_ptr_deleter_sfinae<_Dp>;

template <bool _Dummy>
using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;

template <bool _Dummy>
using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;

template <bool _Dummy>
using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;

template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type>
using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
__enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>;

template <class _ArgType>
using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
__enable_if_t<_Dummy && is_default_constructible<deleter_type>::value && !is_pointer<deleter_type>::value>;

template <class _UPtr, class _Up>
using _EnableIfMoveConvertible _LIBCPP_NODEBUG =
Expand All @@ -193,20 +156,27 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr {
: __ptr_(__p),
__deleter_() {}

template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT
template <bool _Dummy = true,
__enable_if_t<_Dummy && is_constructible<deleter_type, const deleter_type&>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, const deleter_type& __d) _NOEXCEPT
: __ptr_(__p),
__deleter_(__d) {}

template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
template <bool _Dummy = true,
__enable_if_t<_Dummy && !is_reference<deleter_type>::value &&
is_constructible<deleter_type, deleter_type&&>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, deleter_type&& __d) _NOEXCEPT
: __ptr_(__p),
__deleter_(std::move(__d)) {
static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}

template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
_LIBCPP_HIDE_FROM_ABI unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
template <bool _Dummy = true,
__enable_if_t<_Dummy && is_reference<deleter_type>::value &&
is_constructible<deleter_type, __libcpp_remove_reference_t<deleter_type>&&>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI unique_ptr(pointer __p, __libcpp_remove_reference_t<deleter_type>&& __d) = delete;

_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
: __ptr_(__u.release()),
Expand Down Expand Up @@ -438,20 +408,9 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr<_Tp[], _Dp> {
(is_same<pointer, element_type*>::value &&
is_convertible<_FromElem (*)[], element_type (*)[]>::value) > {};

typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;

template <bool _Dummy>
using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;

template <bool _Dummy>
using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;

template <bool _Dummy>
using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;

template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type>
using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
__enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>;
__enable_if_t<_Dummy && is_default_constructible<deleter_type>::value && !is_pointer<deleter_type>::value>;

template <class _ArgType>
using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
Expand Down Expand Up @@ -495,42 +454,48 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr<_Tp[], _Dp> {
__checker_(__size) {}

template <class _Pp,
bool _Dummy = true,
class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,
class = _EnableIfPointerConvertible<_Pp> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __ptr, _LValRefType<_Dummy> __deleter) _NOEXCEPT
bool _Dummy = true,
__enable_if_t<_Dummy && is_constructible<deleter_type, const deleter_type&>::value, int> = 0,
class = _EnableIfPointerConvertible<_Pp> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __ptr, const deleter_type& __deleter) _NOEXCEPT
: __ptr_(__ptr),
__deleter_(__deleter) {}

template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _LValRefType<_Dummy> __deleter) _NOEXCEPT
template <bool _Dummy = true,
__enable_if_t<_Dummy && is_constructible<deleter_type, const deleter_type&>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, const deleter_type& __deleter) _NOEXCEPT
: __ptr_(nullptr),
__deleter_(__deleter) {}

template <class _Pp,
bool _Dummy = true,
class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >,
class = _EnableIfPointerConvertible<_Pp> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
unique_ptr(_Pp __ptr, _GoodRValRefType<_Dummy> __deleter) _NOEXCEPT
bool _Dummy = true,
__enable_if_t<_Dummy && !is_reference<deleter_type>::value &&
is_constructible<deleter_type, deleter_type&&>::value,
int> = 0,
class = _EnableIfPointerConvertible<_Pp> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __ptr, deleter_type&& __deleter) _NOEXCEPT
: __ptr_(__ptr),
__deleter_(std::move(__deleter)) {
static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}

template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __deleter) _NOEXCEPT
template <bool _Dummy = true,
__enable_if_t<_Dummy && !is_reference<deleter_type>::value &&
is_constructible<deleter_type, deleter_type&&>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, deleter_type&& __deleter) _NOEXCEPT
: __ptr_(nullptr),
__deleter_(std::move(__deleter)) {
static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}

template <class _Pp,
bool _Dummy = true,
class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
class = _EnableIfPointerConvertible<_Pp> >
_LIBCPP_HIDE_FROM_ABI unique_ptr(_Pp __ptr, _BadRValRefType<_Dummy> __deleter) = delete;
bool _Dummy = true,
__enable_if_t<_Dummy && is_reference<deleter_type>::value &&
is_constructible<deleter_type, __libcpp_remove_reference_t<deleter_type>&&>::value,
int> = 0,
class = _EnableIfPointerConvertible<_Pp> >
_LIBCPP_HIDE_FROM_ABI unique_ptr(_Pp __ptr, __libcpp_remove_reference_t<deleter_type>&& __deleter) = delete;

_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
: __ptr_(__u.release()),
Expand Down
25 changes: 0 additions & 25 deletions libcxx/include/__type_traits/dependent_type.h

This file was deleted.

1 change: 0 additions & 1 deletion libcxx/include/module.modulemap.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ module std_core [system] {
module copy_cvref { header "__type_traits/copy_cvref.h" }
module datasizeof { header "__type_traits/datasizeof.h" }
module decay { header "__type_traits/decay.h" }
module dependent_type { header "__type_traits/dependent_type.h" }
module desugars_to { header "__type_traits/desugars_to.h" }
module detected_or { header "__type_traits/detected_or.h" }
module disjunction { header "__type_traits/disjunction.h" }
Expand Down
11 changes: 4 additions & 7 deletions libcxx/include/variant
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ namespace std {
# include <__type_traits/conditional.h>
# include <__type_traits/conjunction.h>
# include <__type_traits/decay.h>
# include <__type_traits/dependent_type.h>
# include <__type_traits/enable_if.h>
# include <__type_traits/invoke.h>
# include <__type_traits/is_array.h>
Expand Down Expand Up @@ -1174,8 +1173,7 @@ public:
conditional_t<_And<__libcpp_is_trivially_relocatable<_Types>...>::value, variant, void>;
using __replaceable _LIBCPP_NODEBUG = conditional_t<_And<__is_replaceable<_Types>...>::value, variant, void>;

template <bool _Dummy = true,
enable_if_t<__dependent_type<is_default_constructible<__first_type>, _Dummy>::value, int> = 0>
template <bool _Dummy = true, enable_if_t<_Dummy && is_default_constructible<__first_type>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>)
: __impl_(in_place_index<0>) {}

Expand Down Expand Up @@ -1290,10 +1288,9 @@ public:

_LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); }

template < bool _Dummy = true,
enable_if_t< __all<(__dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
__dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value,
int> = 0>
template <
bool _Dummy = true,
enable_if_t<_Dummy && __all<(is_move_constructible_v<_Types> && is_swappable_v<_Types>)...>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(variant& __that) noexcept(
__all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) {
__impl_.__swap(__that.__impl_);
Expand Down
Loading