diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-02-15 00:41:34 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-02-15 00:41:34 +0000 |
commit | 9741d6c96e861260c9f90b04c09f66dc9f87bb14 (patch) | |
tree | a2da17a210c3e2a9253324369ce447f9534ef62e /libcxx/include/__split_buffer | |
parent | 49d6cc8457edaf98f199eaf936103d010883c8d7 (diff) | |
download | bcm5719-llvm-9741d6c96e861260c9f90b04c09f66dc9f87bb14.tar.gz bcm5719-llvm-9741d6c96e861260c9f90b04c09f66dc9f87bb14.zip |
Implement a few optimizations for vector push_back and insert. Fixes r10828365.
llvm-svn: 150542
Diffstat (limited to 'libcxx/include/__split_buffer')
-rw-r--r-- | libcxx/include/__split_buffer | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer index f28a6e590cf..e0aa13b8988 100644 --- a/libcxx/include/__split_buffer +++ b/libcxx/include/__split_buffer @@ -95,7 +95,7 @@ public: void reserve(size_type __n); void shrink_to_fit() _NOEXCEPT; void push_front(const_reference __x); - void push_back(const_reference __x); + _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) void push_front(value_type&& __x); void push_back(value_type&& __x); @@ -133,8 +133,10 @@ public: _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) _NOEXCEPT - {__destruct_at_end(__new_last, is_trivially_destructible<value_type>());} + {__destruct_at_end(__new_last, false_type());} + _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT; void swap(__split_buffer& __x) @@ -287,7 +289,7 @@ _LIBCPP_INLINE_VISIBILITY inline void __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) { - while (__begin_ < __new_begin) + while (__begin_ != __new_begin) __alloc_traits::destroy(__alloc(), __begin_++); } @@ -304,7 +306,7 @@ _LIBCPP_INLINE_VISIBILITY inline void __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT { - while (__new_last < __end_) + while (__new_last != __end_) __alloc_traits::destroy(__alloc(), --__end_); } |