This revision was automatically updated to reflect the committed changes.
Closed by commit rL308932: Remove addtional parameters in function std::next() 
and std::prev() (authored by rcraik).

Changed prior to commit:
  https://reviews.llvm.org/D34649?vs=104030&id=107977#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34649

Files:
  libcxx/trunk/include/iterator
  
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
  
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp


Index: libcxx/trunk/include/iterator
===================================================================
--- libcxx/trunk/include/iterator
+++ libcxx/trunk/include/iterator
@@ -604,21 +604,27 @@
 
 template <class _InputIter>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-_InputIter
+typename enable_if
+<
+    __is_input_iterator<_InputIter>::value, 
+    _InputIter
+>::type
 next(_InputIter __x,
-     typename iterator_traits<_InputIter>::difference_type __n = 1,
-     typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0)
+     typename iterator_traits<_InputIter>::difference_type __n = 1)
 {
     _VSTD::advance(__x, __n);
     return __x;
 }
 
-template <class _BidiretionalIter>
+template <class _BidirectionalIter>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-_BidiretionalIter
-prev(_BidiretionalIter __x,
-     typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
-     typename 
enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
+typename enable_if
+<
+    __is_bidirectional_iterator<_BidirectionalIter>::value, 
+    _BidirectionalIter
+>::type
+prev(_BidirectionalIter __x,
+     typename iterator_traits<_BidirectionalIter>::difference_type __n = 1)
 {
     _VSTD::advance(__x, -__n);
     return __x;
Index: 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
===================================================================
--- 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
+++ 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
@@ -24,6 +24,9 @@
 test(It i, typename std::iterator_traits<It>::difference_type n, It x)
 {
     assert(std::next(i, n) == x);
+
+    It (*next)(It, typename std::iterator_traits<It>::difference_type) = 
std::next;
+    assert(next(i, n) == x);
 }
 
 template <class It>
Index: 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
===================================================================
--- 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
+++ 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
@@ -22,6 +22,9 @@
 test(It i, typename std::iterator_traits<It>::difference_type n, It x)
 {
     assert(std::prev(i, n) == x);
+
+    It (*prev)(It, typename std::iterator_traits<It>::difference_type) = 
std::prev;
+    assert(prev(i, n) == x);
 }
 
 template <class It>


Index: libcxx/trunk/include/iterator
===================================================================
--- libcxx/trunk/include/iterator
+++ libcxx/trunk/include/iterator
@@ -604,21 +604,27 @@
 
 template <class _InputIter>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-_InputIter
+typename enable_if
+<
+    __is_input_iterator<_InputIter>::value, 
+    _InputIter
+>::type
 next(_InputIter __x,
-     typename iterator_traits<_InputIter>::difference_type __n = 1,
-     typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0)
+     typename iterator_traits<_InputIter>::difference_type __n = 1)
 {
     _VSTD::advance(__x, __n);
     return __x;
 }
 
-template <class _BidiretionalIter>
+template <class _BidirectionalIter>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-_BidiretionalIter
-prev(_BidiretionalIter __x,
-     typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
-     typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
+typename enable_if
+<
+    __is_bidirectional_iterator<_BidirectionalIter>::value, 
+    _BidirectionalIter
+>::type
+prev(_BidirectionalIter __x,
+     typename iterator_traits<_BidirectionalIter>::difference_type __n = 1)
 {
     _VSTD::advance(__x, -__n);
     return __x;
Index: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
===================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
@@ -24,6 +24,9 @@
 test(It i, typename std::iterator_traits<It>::difference_type n, It x)
 {
     assert(std::next(i, n) == x);
+
+    It (*next)(It, typename std::iterator_traits<It>::difference_type) = std::next;
+    assert(next(i, n) == x);
 }
 
 template <class It>
Index: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
===================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
@@ -22,6 +22,9 @@
 test(It i, typename std::iterator_traits<It>::difference_type n, It x)
 {
     assert(std::prev(i, n) == x);
+
+    It (*prev)(It, typename std::iterator_traits<It>::difference_type) = std::prev;
+    assert(prev(i, n) == x);
 }
 
 template <class It>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to