diff options
author | dim <dim@FreeBSD.org> | 2014-03-05 19:30:36 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-03-05 19:30:36 +0000 |
commit | 22ca1336dcfb663d86a6892dbe1e48eee20bb6db (patch) | |
tree | 72f4bceef54682e8e577b4ddd08c0ad24ea08ff6 /contrib/libc++/include/list | |
parent | a5552de0b34d11a40bdc1d8e53fa44a923b6b1a8 (diff) | |
download | FreeBSD-src-22ca1336dcfb663d86a6892dbe1e48eee20bb6db.zip FreeBSD-src-22ca1336dcfb663d86a6892dbe1e48eee20bb6db.tar.gz |
MFC r261283:
Import libc++ 3.4 release. This contains a lot of bugfixes, and some
preliminary support for C++1y.
MFC r261604:
HEAD is not buildable for the past day. Commit a 'quick fix' in order to permit
buildworld to complete.
Reviewed by: theraven
MFC r261608:
Apply a cleaner solution for the sign warnings that can occur when
compiling libc++'s <locale> header with -Wsystem-headers on.
This has also been submitted upstream.
Reported by: asomers
MFC r261801:
An ABI incompatibility crept into the libc++ 3.4 import in r261283. It
was caused by upstream libc++ commit r194536, which aimed to make the
headers more standards-compliant, by making std::pair's copy constructor
trivial. Unfortunately, this could cause certain C++ applications using
shared libraries built against the previous version of libc++ to crash.
Fix the ABI incompatibility by making std::pair's copy constructor
non-trivial again.
Please note: Any C++ applications or shared libraries built with libc++
between r261283 and this revision should be recompiled.
Reported by: stefanf
Diffstat (limited to 'contrib/libc++/include/list')
-rw-r--r-- | contrib/libc++/include/list | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/contrib/libc++/include/list b/contrib/libc++/include/list index 628a35b..800a1a3 100644 --- a/contrib/libc++/include/list +++ b/contrib/libc++/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) { |