Use __builtin_operator_new/__builtin_operator_delete when available. This
allows allocations and deallocations to be optimized out. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210211 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -55,14 +55,14 @@ public:
|
||||
__allocated_ = true;
|
||||
return (pointer)&buf_;
|
||||
}
|
||||
return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));
|
||||
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
||||
{
|
||||
if (__p == (pointer)&buf_)
|
||||
__allocated_ = false;
|
||||
else
|
||||
::operator delete(__p);
|
||||
_VSTD::__deallocate(__p);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
|
Reference in New Issue
Block a user