aboutsummaryrefslogtreecommitdiff
path: root/system/include/libcxx/vector
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-08 15:56:02 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-08 15:56:02 -0800
commite0268fa1035a718341c53921eee9318d4a8033cd (patch)
tree2b3eeb07928f9521498332002444dbfa44f34dfb /system/include/libcxx/vector
parenta11272805c16be75f5e6d00c8214afcac7ba9d05 (diff)
parentad1da1e6685d4483e096d7e0bbd8e38e686bd322 (diff)
Merge pull request #1767 from waywardmonkeys/update-libcxx1.7.2
Update libcxx
Diffstat (limited to 'system/include/libcxx/vector')
-rw-r--r--system/include/libcxx/vector205
1 files changed, 114 insertions, 91 deletions
diff --git a/system/include/libcxx/vector b/system/include/libcxx/vector
index 0758f75b..6ac78d5d 100644
--- a/system/include/libcxx/vector
+++ b/system/include/libcxx/vector
@@ -38,6 +38,7 @@ public:
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit vector(const allocator_type&);
explicit vector(size_type n);
+ explicit vector(size_type n, const allocator_type&); // C++14
vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
template <class InputIterator>
vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
@@ -161,7 +162,8 @@ public:
vector()
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit vector(const allocator_type&);
- explicit vector(size_type n, const value_type& value = value_type(), const allocator_type& = allocator_type());
+ explicit vector(size_type n, const allocator_type& a = allocator_type()); // C++14
+ vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
template <class InputIterator>
vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
vector(const vector& x);
@@ -216,8 +218,10 @@ public:
const_reference back() const;
void push_back(const value_type& x);
+ template <class... Args> void emplace_back(Args&&... args); // C++14
void pop_back();
+ template <class... Args> iterator emplace(const_iterator position, Args&&... args); // C++14
iterator insert(const_iterator position, const value_type& x);
iterator insert(const_iterator position, size_type n, const value_type& x);
template <class InputIterator>
@@ -272,7 +276,7 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
#include <__undef_min_max>
-#ifdef _LIBCPP_DEBUG2
+#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
@@ -319,7 +323,7 @@ __vector_base_common<__b>::__throw_out_of_range() const
#pragma warning( push )
#pragma warning( disable: 4231 )
#endif // _LIBCPP_MSVC
-_LIBCPP_EXTERN_TEMPLATE(class __vector_base_common<true>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __vector_base_common<true>)
#ifdef _LIBCPP_MSVC
#pragma warning( pop )
#endif // _LIBCPP_MSVC
@@ -436,7 +440,7 @@ private:
};
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
__vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
{
@@ -445,7 +449,7 @@ __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
__vector_base<_Tp, _Allocator>::__vector_base()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __begin_(nullptr),
@@ -455,7 +459,7 @@ __vector_base<_Tp, _Allocator>::__vector_base()
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
__vector_base<_Tp, _Allocator>::__vector_base(const allocator_type& __a)
: __begin_(nullptr),
__end_(nullptr),
@@ -474,7 +478,7 @@ __vector_base<_Tp, _Allocator>::~__vector_base()
}
template <class _Tp, class _Allocator = allocator<_Tp> >
-class _LIBCPP_TYPE_VIS vector
+class _LIBCPP_TYPE_VIS_ONLY vector
: private __vector_base<_Tp, _Allocator>
{
private:
@@ -514,15 +518,19 @@ public:
#endif
}
explicit vector(size_type __n);
+#if _LIBCPP_STD_VER > 11
+ explicit vector(size_type __n, const allocator_type& __a);
+#endif
vector(size_type __n, const_reference __x);
vector(size_type __n, const_reference __x, const allocator_type& __a);
template <class _InputIterator>
- vector(_InputIterator __first, _InputIterator __last,
+ vector(_InputIterator __first,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value &&
is_constructible<
value_type,
- typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
+ typename iterator_traits<_InputIterator>::reference>::value,
+ _InputIterator>::type __last);
template <class _InputIterator>
vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
@@ -531,11 +539,12 @@ public:
value_type,
typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
template <class _ForwardIterator>
- vector(_ForwardIterator __first, _ForwardIterator __last,
+ vector(_ForwardIterator __first,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
is_constructible<
value_type,
- typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
+ typename iterator_traits<_ForwardIterator>::reference>::value,
+ _ForwardIterator>::type __last);
template <class _ForwardIterator>
vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
@@ -888,7 +897,7 @@ vector<_Tp, _Allocator>::max_size() const _NOEXCEPT
// Precondition: __new_size > capacity()
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::size_type
vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
{
@@ -926,7 +935,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
@@ -1020,6 +1029,22 @@ vector<_Tp, _Allocator>::vector(size_type __n)
}
}
+#if _LIBCPP_STD_VER > 11
+template <class _Tp, class _Allocator>
+vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
+ : __base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_c(this);
+#endif
+ if (__n > 0)
+ {
+ allocate(__n);
+ __construct_at_end(__n);
+ }
+}
+#endif
+
template <class _Tp, class _Allocator>
vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x)
{
@@ -1049,12 +1074,13 @@ vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x, const alloca
template <class _Tp, class _Allocator>
template <class _InputIterator>
-vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
+vector<_Tp, _Allocator>::vector(_InputIterator __first,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value &&
is_constructible<
value_type,
- typename iterator_traits<_InputIterator>::reference>::value>::type*)
+ typename iterator_traits<_InputIterator>::reference>::value,
+ _InputIterator>::type __last)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@@ -1082,11 +1108,12 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c
template <class _Tp, class _Allocator>
template <class _ForwardIterator>
-vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
+vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
is_constructible<
value_type,
- typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
+ typename iterator_traits<_ForwardIterator>::reference>::value,
+ _ForwardIterator>::type __last)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@@ -1152,7 +1179,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>::vector(vector&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __base(_VSTD::move(__x.__alloc()))
@@ -1168,7 +1195,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x)
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
: __base(__a)
{
@@ -1195,7 +1222,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1209,7 +1236,7 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
: __base(__a)
{
@@ -1226,7 +1253,7 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(vector&& __x)
_NOEXCEPT_(
@@ -1270,7 +1297,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(const vector& __x)
{
@@ -1359,7 +1386,7 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
{
@@ -1371,7 +1398,7 @@ vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::const_iterator
vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
{
@@ -1383,7 +1410,7 @@ vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::begin() _NOEXCEPT
{
@@ -1391,7 +1418,7 @@ vector<_Tp, _Allocator>::begin() _NOEXCEPT
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::const_iterator
vector<_Tp, _Allocator>::begin() const _NOEXCEPT
{
@@ -1399,7 +1426,7 @@ vector<_Tp, _Allocator>::begin() const _NOEXCEPT
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::end() _NOEXCEPT
{
@@ -1407,7 +1434,7 @@ vector<_Tp, _Allocator>::end() _NOEXCEPT
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::const_iterator
vector<_Tp, _Allocator>::end() const _NOEXCEPT
{
@@ -1415,7 +1442,7 @@ vector<_Tp, _Allocator>::end() const _NOEXCEPT
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::reference
vector<_Tp, _Allocator>::operator[](size_type __n)
{
@@ -1424,7 +1451,7 @@ vector<_Tp, _Allocator>::operator[](size_type __n)
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::const_reference
vector<_Tp, _Allocator>::operator[](size_type __n) const
{
@@ -1502,7 +1529,7 @@ vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
vector<_Tp, _Allocator>::push_back(const_reference __x)
{
@@ -1519,7 +1546,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
vector<_Tp, _Allocator>::push_back(value_type&& __x)
{
@@ -1551,7 +1578,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
@@ -1570,7 +1597,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
vector<_Tp, _Allocator>::pop_back()
{
@@ -1579,7 +1606,7 @@ vector<_Tp, _Allocator>::pop_back()
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::erase(const_iterator __position)
{
@@ -1989,7 +2016,7 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __
#endif // _LIBCPP_DEBUG_LEVEL >= 2
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
vector<_Tp, _Allocator>::__invalidate_all_iterators()
{
@@ -2011,7 +2038,7 @@ struct __has_storage_type<vector<bool, _Allocator> >
};
template <class _Allocator>
-class _LIBCPP_TYPE_VIS vector<bool, _Allocator>
+class _LIBCPP_TYPE_VIS_ONLY vector<bool, _Allocator>
: private __vector_base_common<true>
{
public:
@@ -2024,21 +2051,8 @@ public:
typedef size_type __storage_type;
typedef __bit_iterator<vector, false> pointer;
typedef __bit_iterator<vector, true> const_pointer;
-#ifdef _LIBCPP_DEBUG
- typedef __debug_iter<vector, pointer> iterator;
- typedef __debug_iter<vector, const_pointer> const_iterator;
-
- friend class __debug_iter<vector, pointer>;
- friend class __debug_iter<vector, const_pointer>;
-
- pair<iterator*, const_iterator*> __iterator_list_;
-
- _LIBCPP_INLINE_VISIBILITY iterator*& __get_iterator_list(iterator*) {return __iterator_list_.first;}
- _LIBCPP_INLINE_VISIBILITY const_iterator*& __get_iterator_list(const_iterator*) {return __iterator_list_.second;}
-#else // _LIBCPP_DEBUG
typedef pointer iterator;
typedef const_pointer const_iterator;
-#endif // _LIBCPP_DEBUG
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
@@ -2090,6 +2104,9 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a);
~vector();
explicit vector(size_type __n);
+#if _LIBCPP_STD_VER > 11
+ explicit vector(size_type __n, const allocator_type& __a);
+#endif
vector(size_type __n, const value_type& __v);
vector(size_type __n, const value_type& __v, const allocator_type& __a);
template <class _InputIterator>
@@ -2221,8 +2238,20 @@ public:
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __make_ref(__size_ - 1);}
void push_back(const value_type& __x);
+#if _LIBCPP_STD_VER > 11
+ template <class... _Args>
+ _LIBCPP_INLINE_VISIBILITY void emplace_back(_Args&&... __args)
+ { push_back ( value_type ( _VSTD::forward<_Args>(__args)... )); }
+#endif
+
_LIBCPP_INLINE_VISIBILITY void pop_back() {--__size_;}
+#if _LIBCPP_STD_VER > 11
+ template <class... _Args>
+ _LIBCPP_INLINE_VISIBILITY iterator emplace(const_iterator position, _Args&&... __args)
+ { return insert ( position, value_type ( _VSTD::forward<_Args>(__args)... )); }
+#endif
+
iterator insert(const_iterator __position, const value_type& __x);
iterator insert(const_iterator __position, size_type __n, const value_type& __x);
iterator insert(const_iterator __position, size_type __n, const_reference __x);
@@ -2267,7 +2296,7 @@ private:
void allocate(size_type __n);
void deallocate() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
- static size_type __align(size_type __new_size) _NOEXCEPT
+ static size_type __align_it(size_type __new_size) _NOEXCEPT
{return __new_size + (__bits_per_word-1) & ~(__bits_per_word-1);};
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
@@ -2285,14 +2314,6 @@ private:
_LIBCPP_INLINE_VISIBILITY
const_reference __make_ref(size_type __pos) const _NOEXCEPT
{return const_reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
-#ifdef _LIBCPP_DEBUG
- _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_type __pos)
- {return iterator(this, pointer(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word)));}
- _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_type __pos) const
- {return const_iterator(this, const_pointer(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word)));}
- _LIBCPP_INLINE_VISIBILITY iterator __const_iterator_cast(const_iterator __p)
- {return iterator(this, pointer(const_cast<__storage_pointer>(__p.base().__seg_), __p.base().__ctz_));}
-#else // _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
iterator __make_iter(size_type __pos) _NOEXCEPT
{return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
@@ -2302,7 +2323,6 @@ private:
_LIBCPP_INLINE_VISIBILITY
iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT
{return begin() + (__p - cbegin());}
-#endif // _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const vector& __v)
@@ -2369,20 +2389,14 @@ private:
friend class __bit_iterator<vector, false>;
friend class __bit_iterator<vector, true>;
friend struct __bit_array<vector>;
- friend struct _LIBCPP_TYPE_VIS hash<vector>;
+ friend struct _LIBCPP_TYPE_VIS_ONLY hash<vector>;
};
template <class _Allocator>
-#ifndef _LIBCPP_DEBUG
-_LIBCPP_INLINE_VISIBILITY inline
-#endif
+inline _LIBCPP_INLINE_VISIBILITY
void
vector<bool, _Allocator>::__invalidate_all_iterators()
{
-#ifdef _LIBCPP_DEBUG
- iterator::__remove_all(this);
- const_iterator::__remove_all(this);
-#endif // _LIBCPP_DEBUG
}
// Allocate space for __n objects
@@ -2430,7 +2444,7 @@ vector<bool, _Allocator>::max_size() const _NOEXCEPT
// Precondition: __new_size > capacity()
template <class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<bool, _Allocator>::size_type
vector<bool, _Allocator>::__recommend(size_type __new_size) const
{
@@ -2440,7 +2454,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const
const size_type __cap = capacity();
if (__cap >= __ms / 2)
return __ms;
- return _VSTD::max(2*__cap, __align(__new_size));
+ return _VSTD::max(2*__cap, __align_it(__new_size));
}
// Default constructs __n objects starting at __end_
@@ -2448,7 +2462,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x)
{
@@ -2472,7 +2486,7 @@ vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardI
}
template <class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<bool, _Allocator>::vector()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __begin_(nullptr),
@@ -2482,7 +2496,7 @@ vector<bool, _Allocator>::vector()
}
template <class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<bool, _Allocator>::vector(const allocator_type& __a)
: __begin_(nullptr),
__size_(0),
@@ -2503,6 +2517,21 @@ vector<bool, _Allocator>::vector(size_type __n)
}
}
+#if _LIBCPP_STD_VER > 11
+template <class _Allocator>
+vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a)
+ : __begin_(nullptr),
+ __size_(0),
+ __cap_alloc_(0, static_cast<__storage_allocator>(__a))
+{
+ if (__n > 0)
+ {
+ allocate(__n);
+ __construct_at_end(__n, false);
+ }
+}
+#endif
+
template <class _Allocator>
vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
: __begin_(nullptr),
@@ -2652,9 +2681,7 @@ vector<bool, _Allocator>::~vector()
{
if (__begin_ != nullptr)
__storage_traits::deallocate(__alloc(), __begin_, __cap());
-#ifdef _LIBCPP_DEBUG
__invalidate_all_iterators();
-#endif
}
template <class _Allocator>
@@ -2707,7 +2734,7 @@ vector<bool, _Allocator>::operator=(const vector& __v)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<bool, _Allocator>::vector(vector&& __v)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __begin_(__v.__begin_),
@@ -2741,7 +2768,7 @@ vector<bool, _Allocator>::vector(vector&& __v, const allocator_type& __a)
}
template <class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
vector<bool, _Allocator>&
vector<bool, _Allocator>::operator=(vector&& __v)
_NOEXCEPT_(
@@ -3028,7 +3055,7 @@ vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __f
}
template <class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename vector<bool, _Allocator>::iterator
vector<bool, _Allocator>::erase(const_iterator __position)
{
@@ -3059,10 +3086,6 @@ vector<bool, _Allocator>::swap(vector& __x)
_VSTD::swap(this->__size_, __x.__size_);
_VSTD::swap(this->__cap(), __x.__cap());
__swap_alloc(this->__alloc(), __x.__alloc());
-#ifdef _LIBCPP_DEBUG
- iterator::swap(this, &__x);
- const_iterator::swap(this, &__x);
-#endif // _LIBCPP_DEBUG
}
template <class _Allocator>
@@ -3152,7 +3175,7 @@ vector<bool, _Allocator>::__hash_code() const _NOEXCEPT
}
template <class _Allocator>
-struct _LIBCPP_TYPE_VIS hash<vector<bool, _Allocator> >
+struct _LIBCPP_TYPE_VIS_ONLY hash<vector<bool, _Allocator> >
: public unary_function<vector<bool, _Allocator>, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -3161,7 +3184,7 @@ struct _LIBCPP_TYPE_VIS hash<vector<bool, _Allocator> >
};
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3170,7 +3193,7 @@ operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3178,7 +3201,7 @@ operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3186,7 +3209,7 @@ operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3194,7 +3217,7 @@ operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3202,7 +3225,7 @@ operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3210,7 +3233,7 @@ operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
void
swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))