diff options
author | Alexis Hunt <alercah@gmail.com> | 2011-07-30 00:47:53 +0000 |
---|---|---|
committer | Alexis Hunt <alercah@gmail.com> | 2011-07-30 00:47:53 +0000 |
commit | bf78786db0f935c7331cec031e017605aefa5c9c (patch) | |
tree | 2c45849f0833c654b7d36e8fb5046ced1962f377 /libcxx/include/ext | |
parent | 9663c8cb15893ae3d052538a03b1d1b3fa4656d6 (diff) | |
download | bcm5719-llvm-bf78786db0f935c7331cec031e017605aefa5c9c.tar.gz bcm5719-llvm-bf78786db0f935c7331cec031e017605aefa5c9c.zip |
Add the missing default argument for the allocator and use a cleaner
implementation of previous().
llvm-svn: 136547
Diffstat (limited to 'libcxx/include/ext')
-rw-r--r-- | libcxx/include/ext/slist | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/libcxx/include/ext/slist b/libcxx/include/ext/slist index ef115b3d6cd..30ba7e30b43 100644 --- a/libcxx/include/ext/slist +++ b/libcxx/include/ext/slist @@ -21,7 +21,7 @@ namespace __gnu_cxx { using namespace std; -template <class _Tp, class _Alloc> +template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_VISIBLE slist : forward_list<_Tp, _Alloc> { public: @@ -105,12 +105,9 @@ template <class _Tp, class _Alloc> 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 <class _Tp, class _Alloc> 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; } |