aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/libcxx/include/experimental/__memory
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/libcxx/include/experimental/__memory')
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__memory90
1 files changed, 32 insertions, 58 deletions
diff --git a/contrib/llvm-project/libcxx/include/experimental/__memory b/contrib/llvm-project/libcxx/include/experimental/__memory
index fb82922d1eb2..b9dbf541d7e4 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__memory
+++ b/contrib/llvm-project/libcxx/include/experimental/__memory
@@ -25,11 +25,7 @@
_LIBCPP_BEGIN_NAMESPACE_LFTS
-template <
- class _Tp, class _Alloc
- , bool = uses_allocator<_Tp, _Alloc>::value
- , bool = __has_allocator_type<_Tp>::value
- >
+template < class _Tp, class _Alloc, bool = uses_allocator<_Tp, _Alloc>::value, bool = __has_allocator_type<_Tp>::value >
struct __lfts_uses_allocator : public false_type {};
template <class _Tp, class _Alloc>
@@ -40,79 +36,57 @@ struct __lfts_uses_allocator<_Tp, _Alloc, true, HasAlloc> : public true_type {};
template <class _Tp, class _Alloc>
struct __lfts_uses_allocator<_Tp, _Alloc, false, true>
- : public integral_constant<bool
- , is_convertible<_Alloc, typename _Tp::allocator_type>::value
- || is_same<erased_type, typename _Tp::allocator_type>::value
- >
-{};
-
-template <bool _UsesAlloc, class _Tp, class _Alloc, class ..._Args>
-struct __lfts_uses_alloc_ctor_imp
-{
- static const int value = 0;
+ : public integral_constant<bool,
+ is_convertible<_Alloc, typename _Tp::allocator_type>::value ||
+ is_same<erased_type, typename _Tp::allocator_type>::value > {};
+
+template <bool _UsesAlloc, class _Tp, class _Alloc, class... _Args>
+struct __lfts_uses_alloc_ctor_imp {
+ static const int value = 0;
};
-template <class _Tp, class _Alloc, class ..._Args>
-struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...>
-{
- static const bool __ic_first
- = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
+template <class _Tp, class _Alloc, class... _Args>
+struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...> {
+ static const bool __ic_first = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
- static const bool __ic_second =
- __conditional_t<
- __ic_first,
- false_type,
- is_constructible<_Tp, _Args..., _Alloc>
- >::value;
+ static const bool __ic_second =
+ __conditional_t< __ic_first, false_type, is_constructible<_Tp, _Args..., _Alloc> >::value;
- static_assert(__ic_first || __ic_second,
- "Request for uses allocator construction is ill-formed");
+ static_assert(__ic_first || __ic_second, "Request for uses allocator construction is ill-formed");
- static const int value = __ic_first ? 1 : 2;
+ static const int value = __ic_first ? 1 : 2;
};
-template <class _Tp, class _Alloc, class ..._Args>
+template <class _Tp, class _Alloc, class... _Args>
struct __lfts_uses_alloc_ctor
- : integral_constant<int,
- __lfts_uses_alloc_ctor_imp<
- __lfts_uses_allocator<_Tp, _Alloc>::value
- , _Tp, _Alloc, _Args...
- >::value
- >
-{};
+ : integral_constant<
+ int,
+ __lfts_uses_alloc_ctor_imp< __lfts_uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args... >::value > {};
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 0>, _Tp* __storage, const _Allocator&, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (allocator_arg_t(), __a, std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 1>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(allocator_arg_t(), __a, std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)..., __a);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 2>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)..., __a);
}
-template <class _Tp, class _Alloc, class ..._Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __lfts_user_alloc_construct(
- _Tp * __store, const _Alloc & __a, _Args &&... __args)
-{
- ::std::experimental::fundamentals_v1::__user_alloc_construct_impl(
- typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type()
- , __store, __a, std::forward<_Args>(__args)...
- );
+template <class _Tp, class _Alloc, class... _Args>
+inline _LIBCPP_HIDE_FROM_ABI void __lfts_user_alloc_construct(_Tp* __store, const _Alloc& __a, _Args&&... __args) {
+ ::std::experimental::fundamentals_v1::__user_alloc_construct_impl(
+ typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type(), __store, __a, std::forward<_Args>(__args)...);
}
_LIBCPP_END_NAMESPACE_LFTS