aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/vector
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-12-02 21:02:54 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-12-02 21:02:54 +0000
commitf65dcba83ce5035ab88a85fe17628b447eb56e1b (patch)
tree35f37bb72b3cfc6060193e66c76ee7c9478969b0 /libcxx/include/vector
parent846a2208a8ab099f595fe7e8b2e6d54a7b5e67fb (diff)
downloadsrc-f65dcba83ce5035ab88a85fe17628b447eb56e1b.tar.gz
src-f65dcba83ce5035ab88a85fe17628b447eb56e1b.zip
Diffstat (limited to 'libcxx/include/vector')
-rw-r--r--libcxx/include/vector62
1 files changed, 31 insertions, 31 deletions
diff --git a/libcxx/include/vector b/libcxx/include/vector
index e41afbaca509..9b0092cfdbd9 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -350,23 +350,23 @@ class _LIBCPP_TEMPLATE_VIS vector
: private __vector_base<_Tp, _Allocator>
{
private:
- typedef __vector_base<_Tp, _Allocator> __base;
- typedef allocator<_Tp> __default_allocator_type;
+ typedef __vector_base<_Tp, _Allocator> __base;
+ typedef allocator<_Tp> __default_allocator_type;
public:
- typedef vector __self;
- typedef _Tp value_type;
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename __allocator_traits<allocator_type>::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef __wrap_iter<pointer> iterator;
- typedef __wrap_iter<const_pointer> const_iterator;
- typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
- typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef vector __self;
+ typedef _Tp value_type;
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef __wrap_iter<pointer> iterator;
+ typedef __wrap_iter<const_pointer> const_iterator;
+ typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
+ typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
@@ -395,7 +395,21 @@ public:
explicit vector(size_type __n, const allocator_type& __a);
#endif
vector(size_type __n, const value_type& __x);
- vector(size_type __n, const value_type& __x, const allocator_type& __a);
+
+ template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
+ vector(size_type __n, const value_type& __x, const allocator_type& __a)
+ : __base(__a)
+ {
+#if _LIBCPP_DEBUG_LEVEL == 2
+ __get_db()->__insert_c(this);
+#endif
+ if (__n > 0)
+ {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
+ }
+ }
+
template <class _InputIterator>
vector(_InputIterator __first,
typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
@@ -1127,20 +1141,6 @@ vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x)
}
template <class _Tp, class _Allocator>
-vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a)
- : __base(__a)
-{
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__insert_c(this);
-#endif
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
-}
-
-template <class _Tp, class _Allocator>
template <class _InputIterator>
vector<_Tp, _Allocator>::vector(_InputIterator __first,
typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&