Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
include/experimental/memory_resource
Show First 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | public: | ||||
_LIBCPP_INLINE_VISIBILITY | _LIBCPP_INLINE_VISIBILITY | ||||
void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT { | void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT { | ||||
_LIBCPP_ASSERT(__n <= __max_size(), | _LIBCPP_ASSERT(__n <= __max_size(), | ||||
"deallocate called for size which exceeds max_size()"); | "deallocate called for size which exceeds max_size()"); | ||||
__res_->deallocate(__p, __n * sizeof(_ValueType), _LIBCPP_ALIGNOF(_ValueType)); | __res_->deallocate(__p, __n * sizeof(_ValueType), _LIBCPP_ALIGNOF(_ValueType)); | ||||
} | } | ||||
#if _LIBCPP_STD_VER > 17 | |||||
zoecarver: Please note: this **is not tested** (and probably needs further changes). Because of [[ https… | |||||
template <class _Tp, class... _Args> | |||||
_LIBCPP_INLINE_VISIBILITY | |||||
void construct(_Tp* __p, _Args&&... __args) | |||||
{ | |||||
uninitialized_construct_using_allocator(__p, *this, | |||||
_VSTD::forward<_Args>(__args)...); | |||||
} | |||||
#else | |||||
template <class _Tp, class ..._Ts> | template <class _Tp, class ..._Ts> | ||||
_LIBCPP_INLINE_VISIBILITY | _LIBCPP_INLINE_VISIBILITY | ||||
void construct(_Tp* __p, _Ts &&... __args) | void construct(_Tp* __p, _Ts &&... __args) | ||||
{ | { | ||||
_VSTD_LFTS::__lfts_user_alloc_construct( | _VSTD_LFTS::__lfts_user_alloc_construct( | ||||
__p, *this, _VSTD::forward<_Ts>(__args)... | __p, *this, _VSTD::forward<_Ts>(__args)... | ||||
); | ); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | #else | ||||
template <class _T1, class _T2, class _U1, class _U2> | template <class _T1, class _T2, class _U1, class _U2> | ||||
_LIBCPP_INLINE_VISIBILITY | _LIBCPP_INLINE_VISIBILITY | ||||
void construct(pair<_T1, _T2> * __p, pair<_U1, _U2> && __pr){ | void construct(pair<_T1, _T2> * __p, pair<_U1, _U2> && __pr){ | ||||
construct(__p, piecewise_construct | construct(__p, piecewise_construct | ||||
, _VSTD::forward_as_tuple(_VSTD::forward<_U1>(__pr.first)) | , _VSTD::forward_as_tuple(_VSTD::forward<_U1>(__pr.first)) | ||||
, _VSTD::forward_as_tuple(_VSTD::forward<_U2>(__pr.second))); | , _VSTD::forward_as_tuple(_VSTD::forward<_U2>(__pr.second))); | ||||
} | } | ||||
#endif // _LIBCPP_STD_VER > 17 | |||||
template <class _Tp> | template <class _Tp> | ||||
_LIBCPP_INLINE_VISIBILITY | _LIBCPP_INLINE_VISIBILITY | ||||
void destroy(_Tp * __p) _NOEXCEPT | void destroy(_Tp * __p) _NOEXCEPT | ||||
{ __p->~_Tp(); } | { __p->~_Tp(); } | ||||
_LIBCPP_INLINE_VISIBILITY | _LIBCPP_INLINE_VISIBILITY | ||||
polymorphic_allocator | polymorphic_allocator | ||||
▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines |
Please note: this is not tested (and probably needs further changes). Because of 41760 (which I am starting to think is my fault and not an actual bug), I was unable to run many of the polymorphic_allocator tests and therefore could not ensure that this was correctly implemented.