// -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_EXPERIMENTAL___MEMORY #define _LIBCPP_EXPERIMENTAL___MEMORY #include #include // for erased_type #include <__functional_base> #include _LIBCPP_BEGIN_NAMESPACE_LFTS 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 struct __lfts_uses_allocator<_Tp, _Alloc, false, false> : public false_type {}; template struct __lfts_uses_allocator<_Tp, _Alloc, true, HasAlloc> : public true_type {}; template struct __lfts_uses_allocator<_Tp, _Alloc, false, true> : public integral_constant::value || is_same::value > {}; template struct __lfts_uses_alloc_ctor_imp { static const int value = 0; }; template struct __lfts_uses_alloc_ctor_imp { static const bool __ic_first = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; static const bool __ic_second = conditional< __ic_first, false_type, is_constructible<_Tp, _Args..., _Alloc> >::type::value; static_assert(__ic_first || __ic_second, "Request for uses allocator construction is ill-formed"); static const int value = __ic_first ? 1 : 2; }; template struct __lfts_uses_alloc_ctor : integral_constant::value , _Tp, _Alloc, _Args... >::value > {}; template inline _LIBCPP_INLINE_VISIBILITY void __lfts_user_alloc_construct( _Tp * __store, const _Alloc & __a, _Args &&... __args) { _VSTD::__user_alloc_construct_impl( typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type() , __store, __a, _VSTD::forward<_Args>(__args)... ); } _LIBCPP_END_NAMESPACE_LFTS #endif /* _LIBCPP_EXPERIMENTAL___MEMORY */