diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2013-09-14 00:47:59 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2013-09-14 00:47:59 +0000 |
commit | a369cb6280710f25b57ae63d106d46c6d89c9297 (patch) | |
tree | d1c38d6c848c250ff2ff3366e68e4387e81e00ed /libcxx/include/vector | |
parent | e10c8595835b1a00560c96f4b894fcd0d8f34901 (diff) | |
download | bcm5719-llvm-a369cb6280710f25b57ae63d106d46c6d89c9297.tar.gz bcm5719-llvm-a369cb6280710f25b57ae63d106d46c6d89c9297.zip |
LWG Issue 2210 (Part #7): vector and vector<bool>
llvm-svn: 190736
Diffstat (limited to 'libcxx/include/vector')
-rw-r--r-- | libcxx/include/vector | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/libcxx/include/vector b/libcxx/include/vector index e4fc024da52..258a950dc7d 100644 --- a/libcxx/include/vector +++ b/libcxx/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); @@ -516,6 +518,9 @@ 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> @@ -1022,6 +1027,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) { @@ -2079,6 +2100,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> @@ -2489,6 +2513,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), |