aboutsummaryrefslogtreecommitdiff
path: root/include/list
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-04-27 17:27:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-04-27 17:27:12 +0000
commit527d9fcb66574fdd657c3235c0d7cba7c5439d5c (patch)
treef4dbdda47a8f2e8eb8196e6a33ed834e8400837e /include/list
parentc7f918d0681828afdbddfdcc354b6f3dfc2a7b68 (diff)
downloadsrc-527d9fcb66574fdd657c3235c0d7cba7c5439d5c.tar.gz
src-527d9fcb66574fdd657c3235c0d7cba7c5439d5c.zip
Vendor import of libc++ trunk r180598.vendor/libc++/r180598
Notes
Notes: svn path=/vendor/libc++/dist/; revision=249989 svn path=/vendor/libc++/r180598/; revision=249990; tag=vendor/libc++/r180598
Diffstat (limited to 'include/list')
-rw-r--r--include/list23
1 files changed, 17 insertions, 6 deletions
diff --git a/include/list b/include/list
index 812588690014..c6000c972653 100644
--- a/include/list
+++ b/include/list
@@ -213,12 +213,12 @@ struct __list_node
_Tp __value_;
};
-template <class _Tp, class _Alloc> class _LIBCPP_VISIBLE list;
+template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS list;
template <class _Tp, class _Alloc> class __list_imp;
-template <class _Tp, class _VoidPtr> class _LIBCPP_VISIBLE __list_const_iterator;
+template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS __list_const_iterator;
template <class _Tp, class _VoidPtr>
-class _LIBCPP_VISIBLE __list_iterator
+class _LIBCPP_TYPE_VIS __list_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -348,7 +348,7 @@ public:
};
template <class _Tp, class _VoidPtr>
-class _LIBCPP_VISIBLE __list_const_iterator
+class _LIBCPP_TYPE_VIS __list_const_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -394,7 +394,7 @@ public:
#endif
}
_LIBCPP_INLINE_VISIBILITY
- __list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) _NOEXCEPT
+ __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
: __ptr_(__p.__ptr_)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -767,7 +767,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
}
template <class _Tp, class _Alloc = allocator<_Tp> >
-class _LIBCPP_VISIBLE list
+class _LIBCPP_TYPE_VIS list
: private __list_imp<_Tp, _Alloc>
{
typedef __list_imp<_Tp, _Alloc> base;
@@ -1292,7 +1292,11 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return iterator(__hold.release(), this);
+#else
return iterator(__hold.release());
+#endif
}
template <class _Tp, class _Alloc>
@@ -1518,6 +1522,11 @@ template <class... _Args>
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+ "list::emplace(iterator, args...) called with an iterator not"
+ " referring to this list");
+#endif
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
@@ -1624,6 +1633,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
"list::erase(iterator) called with an iterator not"
" referring to this list");
#endif
+ _LIBCPP_ASSERT(__p != end(),
+ "list::erase(iterator) called with a non-dereferenceable iterator");
__node_allocator& __na = base::__node_alloc();
__node& __n = const_cast<__node&>(*__p.__ptr_);
__node_pointer __r = __n.__next_;