From 8f0396e443f24c859a78bfccbb3dbb78aece036c Mon Sep 17 00:00:00 2001 From: Sean Hunt Date: Sat, 30 Jul 2011 00:47:53 +0000 Subject: [PATCH] Add the missing default argument for the allocator and use a cleaner implementation of previous(). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136547 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/ext/slist | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/include/ext/slist b/include/ext/slist index ef115b3d..30ba7e30 100644 --- a/include/ext/slist +++ b/include/ext/slist @@ -21,7 +21,7 @@ namespace __gnu_cxx { using namespace std; -template +template > class _LIBCPP_VISIBLE slist : forward_list<_Tp, _Alloc> { public: @@ -105,12 +105,9 @@ template inline _LIBCPP_INLINE_VISIBILITY typename slist<_Tp, _Alloc>::iterator slist<_Tp, _Alloc>::previous(iterator __pos) { - iterator __a = begin(), __b = end(); - while (__a != __pos) - { - __b = __a; - ++__a; - } + iterator __a = begin(), __b = begin(); + while (++__a != __pos) + ++__b; return __b; } @@ -118,12 +115,9 @@ template inline _LIBCPP_INLINE_VISIBILITY typename slist<_Tp, _Alloc>::const_iterator slist<_Tp, _Alloc>::previous(const_iterator __pos) { - iterator __a = begin(), __b = end(); - while (__a != __pos) - { - __b = __a; - ++__a; - } + iterator __a = begin(), __b = begin(); + while (++__a != __pos) + ++__b; return __b; }