Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Unified Diff: include/memory

Issue 2574553002: [counting-allocator] macOS buildtools/third_party/libc++/trunk/ changes.
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/map ('k') | include/new » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/memory
diff --git a/include/memory b/include/memory
index 65369d2632c409133556ee62edddc6ae43bc00c7..ac43b71b70782a38f01e00bf12f4c5c45082d078 100644
--- a/include/memory
+++ b/include/memory
@@ -1700,6 +1700,27 @@ struct __rebind_alloc_helper
#endif
};
+// allocation_counter
+
+struct allocation_counter
+{
+ struct value
+ {
+ size_t total_usable_size;
+ size_t total_size;
+ size_t total_payload_size;
+ size_t total_count;
+ size_t total_constructed_size;
+ };
+
+ static value get(allocation_group group);
+ static void allocated(allocation_group group, const void* ptr, size_t size, size_t payload_size);
+ static void deallocated(allocation_group group, const void* ptr, size_t size, size_t payload_size);
+
+ static void constructed(allocation_group group, size_t size);
+ static void destroyed(allocation_group group, size_t size);
+};
+
// allocator
template <class _Tp>
@@ -1726,9 +1747,17 @@ public:
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
{return _VSTD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
- {return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));}
- _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
- {_VSTD::__deallocate((void*)__p);}
+ {
+ allocation_group group = allocation_group::allocator;
+ pointer __p = static_cast<pointer>(::operator new(__n * sizeof(_Tp), {get_allocation_group_name(group)}));
+ allocation_counter::allocated(group, __p, __n * sizeof(_Tp), 0);
+ return __p;
+ }
+ _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n) _NOEXCEPT
+ {
+ allocation_counter::deallocated(allocation_group::allocator, __p, __n * sizeof(_Tp), 0);
+ ::operator delete((void*)__p);
+ }
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
{return size_type(~0) / sizeof(_Tp);}
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
@@ -1817,9 +1846,17 @@ public:
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
{return _VSTD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
- {return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));}
- _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
- {_VSTD::__deallocate((void*)__p);}
+ {
+ allocation_group group = allocation_group::allocator;
+ pointer __p = static_cast<pointer>(::operator new(__n * sizeof(_Tp), {get_allocation_group_name(group)}));
+ allocation_counter::allocated(group, __p, __n * sizeof(_Tp), 0);
+ return __p;
+ }
+ _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n) _NOEXCEPT
+ {
+ allocation_counter::deallocated(allocation_group::allocator, __p, __n * sizeof(_Tp), 0);
+ ::operator delete((void*)__p);
+ }
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
{return size_type(~0) / sizeof(_Tp);}
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
@@ -1886,6 +1923,131 @@ public:
_LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
};
+// counting_allocator
+
+struct zero_allocation_payload {};
+
+template <class Payload>
+constexpr size_t get_allocation_payload_size() { return sizeof(Payload); }
+
+template <>
+constexpr size_t get_allocation_payload_size<zero_allocation_payload>() { return 0; }
+
+template <class T, allocation_group Group, class Payload>
+class _LIBCPP_TYPE_VIS_ONLY counting_allocator: public allocator<T>
+{
+ typedef allocator<T> base;
+
+ constexpr static size_t payload_size()
+ {
+ constexpr size_t size = get_allocation_payload_size<Payload>();
+ static_assert(sizeof(T) >= size, "payload is too big");
+ return size;
+ }
+
+public:
+ constexpr static allocation_group group = Group;
+ using payload_type = Payload;
+
+ using typename base::size_type;
+ using typename base::difference_type;
+ using typename base::pointer;
+ using typename base::const_pointer;
+ using typename base::reference;
+ using typename base::const_reference;
+ using typename base::value_type;
+ using typename base::propagate_on_container_move_assignment;
+
+ template <class Other>
+ struct rebind
+ {
+ using other = counting_allocator<Other, Group, zero_allocation_payload>;
+ };
+
+ _LIBCPP_INLINE_VISIBILITY counting_allocator() _NOEXCEPT {}
+
+ template <class Other, allocation_group OtherGroup, class OtherPayload>
+ _LIBCPP_INLINE_VISIBILITY counting_allocator(
+ const counting_allocator<Other, OtherGroup, OtherPayload>&) _NOEXCEPT {}
+
+ _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type n, allocator<void>::const_pointer = 0)
+ {
+ pointer ptr = static_cast<pointer>(::operator new(n * sizeof(T), {get_allocation_group_name(Group)}));
+ allocation_counter::allocated(Group, ptr, sizeof(T) * n, payload_size() * n);
+ return ptr;
+ }
+
+ _LIBCPP_INLINE_VISIBILITY void deallocate(pointer ptr, size_type n) _NOEXCEPT
+ {
+ allocation_counter::deallocated(Group, ptr, sizeof(T) * n, payload_size() * n);
+ _VSTD::__deallocate((void*)ptr);
+ }
+
+ template <class Other, class... Args>
+ _LIBCPP_INLINE_VISIBILITY void construct(Other* ptr, Args&&... args)
+ {
+ static_assert(sizeof(Other) <= sizeof(T), "object is too big");
+ allocation_counter::constructed(Group, sizeof(Other));
+ ::new((void*)ptr) Other(_VSTD::forward<Args>(args)...);
+ }
+
+ template <class Other>
+ _LIBCPP_INLINE_VISIBILITY void destroy(Other* ptr)
+ {
+ allocation_counter::destroyed(Group, sizeof(Other));
+ ptr->~Other();
+ }
+
+ using base::address;
+ using base::max_size;
+};
+
+template <class Traits, class U, bool KeepPayload = true, allocation_group UGroup = allocation_group::invalid_group>
+struct __rebind_counting_alloc_helper
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+ typedef typename Traits::template rebind_alloc<U> type;
+#else
+ typedef typename Traits::template rebind_alloc<U>::other type;
+#endif
+};
+
+template <class T, allocation_group TGroup, class Payload, class U>
+struct __rebind_counting_alloc_helper<allocator_traits<counting_allocator<T, TGroup, Payload>>, U, true, allocation_group::invalid_group>
+{
+ typedef counting_allocator<U, TGroup, Payload> type;
+};
+
+template <class T, allocation_group TGroup, class Payload, class U>
+struct __rebind_counting_alloc_helper<allocator_traits<counting_allocator<T, TGroup, Payload>>, U, false, allocation_group::invalid_group>
+{
+ typedef counting_allocator<U, TGroup, zero_allocation_payload> type;
+};
+
+template <class T, allocation_group TGroup, class Payload, class U, allocation_group UGroup>
+struct __rebind_counting_alloc_helper<allocator_traits<counting_allocator<T, TGroup, Payload>>, U, false, UGroup>
+{
+ typedef counting_allocator<U, UGroup, zero_allocation_payload> type;
+};
+
+template <class Alloc>
+void __count_destroyed(const Alloc&, size_t n) {}
+
+template <class T, allocation_group Group, class Payload>
+void __count_destroyed(const counting_allocator<T, Group, Payload>&, size_t n) {
+ allocation_counter::destroyed(Group, sizeof(T) * n);
+}
+
+template <class Alloc>
+void __count_constructed(const Alloc&, size_t n) {}
+
+template <class T, allocation_group Group, class Payload>
+void __count_constructed(const counting_allocator<T, Group, Payload>&, size_t n) {
+ allocation_counter::constructed(Group, sizeof(T) * n);
+}
+
+// ^ counting_allocator
+
template <class _Tp, class _Up>
inline _LIBCPP_INLINE_VISIBILITY
bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
@@ -3756,6 +3918,18 @@ public:
virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
#endif
+ _LIBCPP_INLINE_VISIBILITY
+ static __shared_ptr_pointer* __make(_Tp __p, _Dp __d = _Dp(), _Alloc __a = _Alloc())
+ {
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, __shared_ptr_pointer>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 _a2(__a);
+ unique_ptr<__shared_ptr_pointer, _D2> __hold2(_a2.allocate(1), _D2(_a2, 1));
+ ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+ __shared_ptr_pointer(_VSTD::move(__p), _VSTD::move(__d), _VSTD::move(__a));
+ return _VSTD::addressof(*__hold2.release());
+ }
+
private:
virtual void __on_zero_shared() _NOEXCEPT;
virtual void __on_zero_shared_weak() _NOEXCEPT;
@@ -3784,7 +3958,7 @@ template <class _Tp, class _Dp, class _Alloc>
void
__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
{
- typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, __shared_ptr_pointer>::type _Al;
typedef allocator_traits<_Al> _ATraits;
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
@@ -3853,7 +4027,7 @@ template <class _Tp, class _Alloc>
void
__shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
{
- typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _Al;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, __shared_ptr_emplace>::type _Al;
typedef allocator_traits<_Al> _ATraits;
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
_Al __a(__data_.first());
@@ -4165,8 +4339,8 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p,
: __ptr_(__p)
{
unique_ptr<_Yp> __hold(__p);
- typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+ typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, counting_allocator<_Yp*, allocation_group::shared_ptr> > _CntrlBlk;
+ __cntrl_ = _CntrlBlk::__make(__p);
__hold.release();
__enable_weak_this(__p);
}
@@ -4181,8 +4355,8 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d,
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+ typedef __shared_ptr_pointer<_Yp*, _Dp, counting_allocator<_Yp*, allocation_group::shared_ptr> > _CntrlBlk;
+ __cntrl_ = _CntrlBlk::__make(__p, __d);
__enable_weak_this(__p);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -4203,8 +4377,8 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- typedef __shared_ptr_pointer<nullptr_t, _Dp, allocator<_Tp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+ typedef __shared_ptr_pointer<nullptr_t, _Dp, counting_allocator<_Tp*, allocation_group::shared_ptr> > _CntrlBlk;
+ __cntrl_ = _CntrlBlk::__make(__p, __d);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -4226,13 +4400,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
{
#endif // _LIBCPP_NO_EXCEPTIONS
typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a2(__a);
- unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
- ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
- _CntrlBlk(__p, __d, __a);
- __cntrl_ = _VSTD::addressof(*__hold2.release());
+ __cntrl_ = _CntrlBlk::__make(__p, __d, __a);
__enable_weak_this(__p);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -4254,13 +4422,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
{
#endif // _LIBCPP_NO_EXCEPTIONS
typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a2(__a);
- unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
- ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
- _CntrlBlk(__p, __d, __a);
- __cntrl_ = _VSTD::addressof(*__hold2.release());
+ __cntrl_ = _CntrlBlk::__make(__p, __d, __a);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -4342,8 +4504,8 @@ shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
: __ptr_(__r.get())
{
- typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>());
+ typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, counting_allocator<_Yp*, allocation_group::shared_ptr> > _CntrlBlk;
+ __cntrl_ = _CntrlBlk::__make(__r.get());
__enable_weak_this(__r.get());
__r.release();
}
@@ -4370,8 +4532,8 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
else
#endif
{
- typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
+ typedef __shared_ptr_pointer<_Yp*, _Dp, counting_allocator<_Yp*, allocation_group::shared_ptr> > _CntrlBlk;
+ __cntrl_ = _CntrlBlk::__make(__r.get(), __r.get_deleter());
__enable_weak_this(__r.get());
}
__r.release();
@@ -4401,8 +4563,8 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
{
typedef __shared_ptr_pointer<_Yp*,
reference_wrapper<typename remove_reference<_Dp>::type>,
- allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
+ counting_allocator<_Yp*, allocation_group::shared_ptr> > _CntrlBlk;
+ __cntrl_ = _CntrlBlk::__make(__r.get(), ref(__r.get_deleter()));
__enable_weak_this(__r.get());
}
__r.release();
@@ -4415,8 +4577,9 @@ template<class ..._Args>
shared_ptr<_Tp>
shared_ptr<_Tp>::make_shared(_Args&& ...__args)
{
- typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
- typedef allocator<_CntrlBlk> _A2;
+ typedef counting_allocator<_Tp, allocation_group::shared_ptr> _Alloc;
+ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _A2;
typedef __allocator_destructor<_A2> _D2;
_A2 __a2;
unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
@@ -4434,7 +4597,7 @@ shared_ptr<_Tp>
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
{
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _A2;
typedef __allocator_destructor<_A2> _D2;
_A2 __a2(__a);
unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
@@ -4453,8 +4616,9 @@ template<class _Tp>
shared_ptr<_Tp>
shared_ptr<_Tp>::make_shared()
{
- typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
- typedef allocator<_CntrlBlk> _Alloc2;
+ typedef counting_allocator<_Tp, allocation_group::shared_ptr> _Alloc;
+ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _Alloc2;
typedef __allocator_destructor<_Alloc2> _D2;
_Alloc2 __alloc2;
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
@@ -4471,8 +4635,9 @@ template<class _A0>
shared_ptr<_Tp>
shared_ptr<_Tp>::make_shared(_A0& __a0)
{
- typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
- typedef allocator<_CntrlBlk> _Alloc2;
+ typedef counting_allocator<_Tp, allocation_group::shared_ptr> _Alloc;
+ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _Alloc2;
typedef __allocator_destructor<_Alloc2> _D2;
_Alloc2 __alloc2;
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
@@ -4489,8 +4654,9 @@ template<class _A0, class _A1>
shared_ptr<_Tp>
shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1)
{
- typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
- typedef allocator<_CntrlBlk> _Alloc2;
+ typedef counting_allocator<_Tp, allocation_group::shared_ptr> _Alloc;
+ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _Alloc2;
typedef __allocator_destructor<_Alloc2> _D2;
_Alloc2 __alloc2;
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
@@ -4507,8 +4673,9 @@ template<class _A0, class _A1, class _A2>
shared_ptr<_Tp>
shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2)
{
- typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
- typedef allocator<_CntrlBlk> _Alloc2;
+ typedef counting_allocator<_Tp, allocation_group::shared_ptr> _Alloc;
+ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _Alloc2;
typedef __allocator_destructor<_Alloc2> _D2;
_Alloc2 __alloc2;
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
@@ -4526,7 +4693,7 @@ shared_ptr<_Tp>
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a)
{
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _Alloc2;
typedef __allocator_destructor<_Alloc2> _D2;
_Alloc2 __alloc2(__a);
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
@@ -4545,7 +4712,7 @@ shared_ptr<_Tp>
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0)
{
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _Alloc2;
typedef __allocator_destructor<_Alloc2> _D2;
_Alloc2 __alloc2(__a);
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
@@ -4564,7 +4731,7 @@ shared_ptr<_Tp>
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)
{
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _Alloc2;
typedef __allocator_destructor<_Alloc2> _D2;
_Alloc2 __alloc2(__a);
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
@@ -4583,7 +4750,7 @@ shared_ptr<_Tp>
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)
{
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
+ typedef typename __rebind_counting_alloc_helper<allocator_traits<_Alloc>, _CntrlBlk>::type _Alloc2;
typedef __allocator_destructor<_Alloc2> _D2;
_Alloc2 __alloc2(__a);
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
« no previous file with comments | « include/map ('k') | include/new » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698