diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2014-01-29 19:30:27 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2014-01-29 19:30:27 +0000 |
commit | a5b2dbc259e289ea23fe9aebb34eba2c1dc7fefb (patch) | |
tree | 5812a629bd48b0968dee7411809c6a6a19680390 /include/list | |
parent | 1c9014238e909c768bf84564733b5441d5c9ea2b (diff) | |
download | src-a5b2dbc259e289ea23fe9aebb34eba2c1dc7fefb.tar.gz src-a5b2dbc259e289ea23fe9aebb34eba2c1dc7fefb.zip |
Vendor import of libc++ tags/RELEASE_34/final r197960:vendor/libc++/r197960
Notes
Notes:
svn path=/vendor/libc++/dist/; revision=261272
svn path=/vendor/libc++/r197960/; revision=261273; tag=vendor/libc++/r197960
Diffstat (limited to 'include/list')
-rw-r--r-- | include/list | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/include/list b/include/list index 628a35bade72..800a1a3f5aa8 100644 --- a/include/list +++ b/include/list @@ -40,6 +40,7 @@ public: noexcept(is_nothrow_default_constructible<allocator_type>::value); explicit list(const allocator_type& a); explicit list(size_type n); + explicit list(size_type n, const allocator_type& a); // C++14 list(size_type n, const value_type& value); list(size_type n, const value_type& value, const allocator_type& a); template <class Iter> @@ -178,6 +179,12 @@ template <class T, class Alloc> #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 @@ -220,12 +227,12 @@ struct __list_node _Tp __value_; }; -template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS list; +template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY list; template <class _Tp, class _Alloc> class __list_imp; -template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS __list_const_iterator; +template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator; template <class _Tp, class _VoidPtr> -class _LIBCPP_TYPE_VIS __list_iterator +class _LIBCPP_TYPE_VIS_ONLY __list_iterator { typedef typename pointer_traits<_VoidPtr>::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES @@ -267,7 +274,7 @@ public: typedef typename pointer_traits<pointer>::difference_type difference_type; _LIBCPP_INLINE_VISIBILITY - __list_iterator() _NOEXCEPT + __list_iterator() _NOEXCEPT : __ptr_(nullptr) { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_i(this); @@ -350,10 +357,6 @@ public: friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __list_iterator& __x, const __list_iterator& __y) { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare non-comparable list::iterator"); -#endif return __x.__ptr_ == __y.__ptr_; } friend _LIBCPP_INLINE_VISIBILITY @@ -362,7 +365,7 @@ public: }; template <class _Tp, class _VoidPtr> -class _LIBCPP_TYPE_VIS __list_const_iterator +class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator { typedef typename pointer_traits<_VoidPtr>::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES @@ -401,7 +404,7 @@ public: typedef typename pointer_traits<pointer>::difference_type difference_type; _LIBCPP_INLINE_VISIBILITY - __list_const_iterator() _NOEXCEPT + __list_const_iterator() _NOEXCEPT : __ptr_(nullptr) { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_i(this); @@ -491,10 +494,6 @@ public: friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y) { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare non-comparable list::const_iterator"); -#endif return __x.__ptr_ == __y.__ptr_; } friend _LIBCPP_INLINE_VISIBILITY @@ -808,7 +807,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) } template <class _Tp, class _Alloc = allocator<_Tp> > -class _LIBCPP_TYPE_VIS list +class _LIBCPP_TYPE_VIS_ONLY list : private __list_imp<_Tp, _Alloc> { typedef __list_imp<_Tp, _Alloc> base; @@ -844,13 +843,16 @@ public: #endif } _LIBCPP_INLINE_VISIBILITY - list(const allocator_type& __a) : base(__a) + explicit list(const allocator_type& __a) : base(__a) { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); #endif } - list(size_type __n); + explicit list(size_type __n); +#if _LIBCPP_STD_VER > 11 + explicit list(size_type __n, const allocator_type& __a); +#endif list(size_type __n, const value_type& __x); list(size_type __n, const value_type& __x, const allocator_type& __a); template <class _InpIter> @@ -1102,6 +1104,22 @@ list<_Tp, _Alloc>::list(size_type __n) #endif } +#if _LIBCPP_STD_VER > 11 +template <class _Tp, class _Alloc> +list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) +{ +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif + for (; __n > 0; --__n) +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + emplace_back(); +#else + push_back(value_type()); +#endif +} +#endif + template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) { |