diff options
Diffstat (limited to 'include/__split_buffer')
-rw-r--r-- | include/__split_buffer | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/include/__split_buffer b/include/__split_buffer index 33ce42d..e0aa13b 100644 --- a/include/__split_buffer +++ b/include/__split_buffer @@ -6,6 +6,8 @@ #include <type_traits> #include <algorithm> +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif @@ -93,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); @@ -131,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) @@ -150,7 +154,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT + void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY @@ -169,7 +173,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT + static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT {} }; @@ -285,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_++); } @@ -302,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_); } @@ -390,8 +394,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al __first_ = __alloc_traits::allocate(__alloc(), __cap); __begin_ = __end_ = __first_; __end_cap() = __first_ + __cap; - typedef move_iterator<iterator> _I; - __construct_at_end(_I(__c.begin()), _I(__c.end())); + typedef move_iterator<iterator> _Ip; + __construct_at_end(_Ip(__c.begin()), _Ip(__c.end())); } } @@ -488,7 +492,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) } else { - size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); + size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); @@ -519,7 +523,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) } else { - size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); + size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); @@ -552,7 +556,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) } else { - size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); + size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); @@ -583,7 +587,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) } else { - size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); + size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); @@ -616,7 +620,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) } else { - size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); + size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); |