summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/vector
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-01-30 07:44:22 +0000
committerdim <dim@FreeBSD.org>2014-01-30 07:44:22 +0000
commit0b319638e352dd16f2e5a243bd3826d37eef1680 (patch)
treeadd3759d4df7ee10d814c3b2561c3c28fcd9cef2 /contrib/libc++/include/vector
parent9cecf9778c1472e916ad20086c11e4bf332ba6ad (diff)
parentc3e10da3dc0f616b78ccf85206fdcf4c92f8ac85 (diff)
downloadFreeBSD-src-0b319638e352dd16f2e5a243bd3826d37eef1680.zip
FreeBSD-src-0b319638e352dd16f2e5a243bd3826d37eef1680.tar.gz
Import libc++ 3.4 release. This contains a lot of bugfixes, and some
preliminary support for C++1y. MFC after: 3 weeks
Diffstat (limited to 'contrib/libc++/include/vector')
-rw-r--r--contrib/libc++/include/vector217
1 files changed, 123 insertions, 94 deletions
diff --git a/contrib/libc++/include/vector b/contrib/libc++/include/vector
index 046d92d..6ac78d5 100644
--- a/contrib/libc++/include/vector
+++ b/contrib/libc++/include/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,6 +276,12 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
#include <__undef_min_max>
+#ifdef _LIBCPP_DEBUG
+# include <__debug>
+#else
+# define _LIBCPP_ASSERT(x, m) ((void)0)
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -309,14 +319,14 @@ __vector_base_common<__b>::__throw_out_of_range() const
#endif
}
-#ifdef _MSC_VER
+#ifdef _LIBCPP_MSVC
#pragma warning( push )
#pragma warning( disable: 4231 )
-#endif // _MSC_VER
-_LIBCPP_EXTERN_TEMPLATE(class __vector_base_common<true>)
-#ifdef _MSC_VER
+#endif // _LIBCPP_MSVC
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __vector_base_common<true>)
+#ifdef _LIBCPP_MSVC
#pragma warning( pop )
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVC
template <class _Tp, class _Allocator>
class __vector_base
@@ -430,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
{
@@ -439,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),
@@ -449,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),
@@ -468,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:
@@ -508,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 &&
@@ -525,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 &&
@@ -882,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
{
@@ -920,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)
{
@@ -1014,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)
{
@@ -1043,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);
@@ -1076,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);
@@ -1146,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()))
@@ -1162,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)
{
@@ -1189,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
@@ -1203,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)
{
@@ -1220,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_(
@@ -1264,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)
{
@@ -1353,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
{
@@ -1365,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
{
@@ -1377,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
{
@@ -1385,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
{
@@ -1393,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
{
@@ -1401,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
{
@@ -1409,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)
{
@@ -1418,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
{
@@ -1496,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)
{
@@ -1513,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)
{
@@ -1545,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)
{
@@ -1564,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()
{
@@ -1573,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)
{
@@ -1983,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()
{
@@ -2005,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:
@@ -2018,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;
@@ -2084,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>
@@ -2215,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);
@@ -2261,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);
@@ -2279,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));}
@@ -2296,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)
@@ -2363,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
@@ -2424,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
{
@@ -2434,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_
@@ -2442,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)
{
@@ -2466,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),
@@ -2476,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),
@@ -2497,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),
@@ -2646,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>
@@ -2701,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_),
@@ -2735,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_(
@@ -3022,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)
{
@@ -3053,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>
@@ -3146,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
@@ -3155,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)
{
@@ -3164,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)
{
@@ -3172,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)
{
@@ -3180,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)
{
@@ -3188,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)
{
@@ -3196,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)
{
@@ -3204,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)))
OpenPOWER on IntegriCloud