diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-08 15:56:02 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-08 15:56:02 -0800 |
commit | e0268fa1035a718341c53921eee9318d4a8033cd (patch) | |
tree | 2b3eeb07928f9521498332002444dbfa44f34dfb /system/include/libcxx/forward_list | |
parent | a11272805c16be75f5e6d00c8214afcac7ba9d05 (diff) | |
parent | ad1da1e6685d4483e096d7e0bbd8e38e686bd322 (diff) |
Merge pull request #1767 from waywardmonkeys/update-libcxx1.7.2
Update libcxx
Diffstat (limited to 'system/include/libcxx/forward_list')
-rw-r--r-- | system/include/libcxx/forward_list | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/system/include/libcxx/forward_list b/system/include/libcxx/forward_list index 88bf75f9..398226b8 100644 --- a/system/include/libcxx/forward_list +++ b/system/include/libcxx/forward_list @@ -38,6 +38,7 @@ public: noexcept(is_nothrow_default_constructible<allocator_type>::value); explicit forward_list(const allocator_type& a); explicit forward_list(size_type n); + explicit forward_list(size_type n, const allocator_type& a); // C++14 forward_list(size_type n, const value_type& v); forward_list(size_type n, const value_type& v, const allocator_type& a); template <class InputIterator> @@ -212,11 +213,11 @@ struct __forward_list_node value_type __value_; }; -template<class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS forward_list; -template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS __forward_list_const_iterator; +template<class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY forward_list; +template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator; template <class _NodePtr> -class _LIBCPP_TYPE_VIS __forward_list_iterator +class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator { typedef _NodePtr __node_pointer; @@ -225,8 +226,8 @@ class _LIBCPP_TYPE_VIS __forward_list_iterator _LIBCPP_INLINE_VISIBILITY explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} - template<class, class> friend class _LIBCPP_TYPE_VIS forward_list; - template<class> friend class _LIBCPP_TYPE_VIS __forward_list_const_iterator; + template<class, class> friend class _LIBCPP_TYPE_VIS_ONLY forward_list; + template<class> friend class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator; public: typedef forward_iterator_tag iterator_category; @@ -276,7 +277,7 @@ public: }; template <class _NodeConstPtr> -class _LIBCPP_TYPE_VIS __forward_list_const_iterator +class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator { typedef _NodeConstPtr __node_const_pointer; @@ -542,7 +543,7 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT } template <class _Tp, class _Alloc = allocator<_Tp> > -class _LIBCPP_TYPE_VIS forward_list +class _LIBCPP_TYPE_VIS_ONLY forward_list : private __forward_list_base<_Tp, _Alloc> { typedef __forward_list_base<_Tp, _Alloc> base; @@ -571,6 +572,9 @@ public: {} // = default; explicit forward_list(const allocator_type& __a); explicit forward_list(size_type __n); +#if _LIBCPP_STD_VER > 11 + explicit forward_list(size_type __n, const allocator_type& __a); +#endif forward_list(size_type __n, const value_type& __v); forward_list(size_type __n, const value_type& __v, const allocator_type& __a); template <class _InputIterator> @@ -794,6 +798,28 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n) } } +#if _LIBCPP_STD_VER > 11 +template <class _Tp, class _Alloc> +forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __a) + : base ( __a ) +{ + if (__n > 0) + { + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); + for (__node_pointer __p = base::__before_begin(); __n > 0; --__n, + __p = __p->__next_) + { + __h.reset(__node_traits::allocate(__a, 1)); + __node_traits::construct(__a, _VSTD::addressof(__h->__value_)); + __h->__next_ = nullptr; + __p->__next_ = __h.release(); + } + } +} +#endif + template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) { |